private void addAccessLog(HttpServer httpServer) { try { String accessLogLocation = serverData.getRootContext().getBean(AccessLogLocationBean.class).getAccessLogLocation(); accessLogLocation = accessLogLocation + "/" + replaceSlash(serverData.getModule().getContext()) + "-access.log"; final AccessLogBuilder builder = new AccessLogBuilder(accessLogLocation); builder.rotatedDaily(); builder.rotationPattern("yyyy-MM-dd"); builder.instrument(httpServer.getServerConfiguration()); } catch (Exception e) { logger.error(InternalErrorCode.SERVER_STARTUP_FAILED_TO_CREATE_ACCESS_LOG.toString() + ": " + e.getMessage()); if (e.getCause() != null) logger.error("CAUSED BY: " + InternalErrorCode.SERVER_STARTUP_FAILED_TO_CREATE_ACCESS_LOG.toString() + ": " + e.getCause().getMessage()); } }
/** * Set up automatic log-file rotation, on a hourly basis. * * <p>For example, if the file name specified at * {@linkplain #AccessLogBuilder(File) construction} was * <code>access.log</code>, files will be archived on a hourly basis * with names like <code>access-yyyyMMDDhh.log</code>.</p> */ public AccessLogBuilder rotatedHourly() { return rotationPattern("yyyyMMDDhh"); }
/** * Set the <em>time zone</em> that will be used to represent dates. * * <p>The time zone will be looked up by * {@linkplain TimeZone#getTimeZone(String) time zone identifier}, and if * this is invalid or unrecognized, it will default to <em>GMT</em>.</p> */ public AccessLogBuilder timeZone(String timeZone) { if (timeZone == null) throw new NullPointerException("Null time zone"); return this.timeZone(TimeZone.getTimeZone(timeZone)); }
/** * Set the <em>format</em> as a {@link String} compatible with the default * {@linkplain ApacheLogFormat Apache access log format} that will be used * by the access logs configured by this instance. */ public AccessLogBuilder format(String format) { if (format == null) throw new NullPointerException("Null format"); return this.format(new ApacheLogFormat(format)); }
/** * Build an {@link AccessLogProbe} instance and directly instrument it in an * {@link HttpServer}'s {@linkplain HttpServerMonitoringConfig monitoring * configuration} to provide access logging. * * @param serverConfiguration The {@link ServerConfiguration} to instrument. */ public ServerConfiguration instrument(ServerConfiguration serverConfiguration) { serverConfiguration.getMonitoringConfig() .getWebServerConfig() .addProbes(build()); return serverConfiguration; }
/** * Set up automatic log-file rotation, on a daily basis. * * <p>For example, if the file name specified at * {@linkplain #AccessLogBuilder(File) construction} was * <code>access.log</code>, files will be archived on a daily basis * with names like <code>access-yyyyMMDD.log</code>.</p> */ public AccessLogBuilder rotatedDaily() { return rotationPattern("yyyyMMDD"); }
/** * Set the <em>time zone</em> that will be used to represent dates. * * <p>The time zone will be looked up by * {@linkplain TimeZone#getTimeZone(String) time zone identifier}, and if * this is invalid or unrecognized, it will default to <em>GMT</em>.</p> */ public AccessLogBuilder timeZone(String timeZone) { if (timeZone == null) throw new NullPointerException("Null time zone"); return this.timeZone(TimeZone.getTimeZone(timeZone)); }
/** * Set the <em>format</em> as a {@link String} compatible with the default * {@linkplain ApacheLogFormat Apache access log format} that will be used * by the access logs configured by this instance. */ public AccessLogBuilder format(String format) { if (format == null) throw new NullPointerException("Null format"); return this.format(new ApacheLogFormat(format)); }
/** * Build an {@link AccessLogProbe} instance and directly instrument it in an * {@link HttpServer}'s {@linkplain HttpServerMonitoringConfig monitoring * configuration} to provide access logging. * * @param serverConfiguration The {@link ServerConfiguration} to instrument. */ public ServerConfiguration instrument(ServerConfiguration serverConfiguration) { serverConfiguration.getMonitoringConfig() .getWebServerConfig() .addProbes(build()); return serverConfiguration; }
/** * Set up automatic log-file rotation, on a hourly basis. * * <p>For example, if the file name specified at * {@linkplain #AccessLogBuilder(File) construction} was * <code>access.log</code>, files will be archived on a hourly basis * with names like <code>access-yyyyMMDDhh.log</code>.</p> */ public AccessLogBuilder rotatedHourly() { return rotationPattern("yyyyMMDDhh"); }
private void addAccessLog(HttpServer httpServer) { try { String accessLogLocation = serverData.getRootContext().getBean(AccessLogLocationBean.class).getAccessLogLocation(); accessLogLocation = accessLogLocation + "/" + replaceSlash(serverData.getModule().getContext()) + "-access.log"; final AccessLogBuilder builder = new AccessLogBuilder(accessLogLocation); builder.rotatedDaily(); builder.rotationPattern("yyyy-MM-dd"); builder.instrument(httpServer.getServerConfiguration()); } catch (Exception e) { logger.error(InternalErrorCode.SERVER_STARTUP_FAILED_TO_CREATE_ACCESS_LOG.toString() + ": " + e.getMessage()); if (e.getCause() != null) logger.error("CAUSED BY: " + InternalErrorCode.SERVER_STARTUP_FAILED_TO_CREATE_ACCESS_LOG.toString() + ": " + e.getCause().getMessage()); } }
/** * Set the <em>time zone</em> that will be used to represent dates. * * <p>The time zone will be looked up by * {@linkplain TimeZone#getTimeZone(String) time zone identifier}, and if * this is invalid or unrecognized, it will default to <em>GMT</em>.</p> */ public AccessLogBuilder timeZone(String timeZone) { if (timeZone == null) throw new NullPointerException("Null time zone"); return this.timeZone(TimeZone.getTimeZone(timeZone)); }
/** * Set the <em>format</em> as a {@link String} compatible with the default * {@linkplain ApacheLogFormat Apache access log format} that will be used * by the access logs configured by this instance. */ public AccessLogBuilder format(String format) { if (format == null) throw new NullPointerException("Null format"); return this.format(new ApacheLogFormat(format)); }
/** * Build an {@link AccessLogProbe} instance and directly instrument it in an * {@link HttpServer}'s {@linkplain HttpServerMonitoringConfig monitoring * configuration} to provide access logging. * * @param serverConfiguration The {@link ServerConfiguration} to instrument. */ public ServerConfiguration instrument(ServerConfiguration serverConfiguration) { serverConfiguration.getMonitoringConfig() .getWebServerConfig() .addProbes(build()); return serverConfiguration; }
/** * Set up automatic log-file rotation, on a hourly basis. * * <p>For example, if the file name specified at * {@linkplain #AccessLogBuilder(File) construction} was * <code>access.log</code>, files will be archived on a hourly basis * with names like <code>access-yyyyMMDDhh.log</code>.</p> */ public AccessLogBuilder rotatedHourly() { return rotationPattern("yyyyMMDDhh"); }
private void addAccessLog(HttpServer httpServer) { try { String accessLogLocation = serverData.getRootContext().getBean(AccessLogLocationBean.class).getAccessLogLocation(); accessLogLocation = accessLogLocation + "/" + replaceSlash(serverData.getModule().getContext()) + "-access.log"; final AccessLogBuilder builder = new AccessLogBuilder(accessLogLocation); builder.rotatedDaily(); builder.rotationPattern("yyyy-MM-dd"); builder.instrument(httpServer.getServerConfiguration()); } catch (Exception e) { logger.error(InternalErrorCode.SERVER_STARTUP_FAILED_TO_CREATE_ACCESS_LOG.toString() + ": " + e.getMessage()); if (e.getCause() != null) logger.error("CAUSED BY: " + InternalErrorCode.SERVER_STARTUP_FAILED_TO_CREATE_ACCESS_LOG.toString() + ": " + e.getCause().getMessage()); } }
/** * Set the <em>time zone</em> that will be used to represent dates. * * <p>The time zone will be looked up by * {@linkplain TimeZone#getTimeZone(String) time zone identifier}, and if * this is invalid or unrecognized, it will default to <em>GMT</em>.</p> */ public AccessLogBuilder timeZone(String timeZone) { if (timeZone == null) throw new NullPointerException("Null time zone"); return this.timeZone(TimeZone.getTimeZone(timeZone)); }
/** * Set the <em>format</em> as a {@link String} compatible with the default * {@linkplain ApacheLogFormat Apache access log format} that will be used * by the access logs configured by this instance. */ public AccessLogBuilder format(String format) { if (format == null) throw new NullPointerException("Null format"); return this.format(new ApacheLogFormat(format)); }
/** * Build an {@link AccessLogProbe} instance and directly instrument it in an * {@link HttpServer}'s {@linkplain HttpServerMonitoringConfig monitoring * configuration} to provide access logging. * * @param serverConfiguration The {@link ServerConfiguration} to instrument. */ public ServerConfiguration instrument(ServerConfiguration serverConfiguration) { serverConfiguration.getMonitoringConfig() .getWebServerConfig() .addProbes(build()); return serverConfiguration; }
/** * Set up automatic log-file rotation, on a daily basis. * * <p>For example, if the file name specified at * {@linkplain #AccessLogBuilder(File) construction} was * <code>access.log</code>, files will be archived on a daily basis * with names like <code>access-yyyyMMDD.log</code>.</p> */ public AccessLogBuilder rotatedDaily() { return rotationPattern("yyyyMMDD"); }