@Bean public AccessLogLocationBean accessLogLocationBean() { return new AccessLogLocationBean(accessLogLocation); } }
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()); } }
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()); } }
@Bean public AccessLogLocationBean createAccessLogLocationBean( ApplicationContext rootContext) { Properties props = (Properties) rootContext.getBean("propertyFactory"); String location = Optional.ofNullable( (String) props.get("access.log.output")).orElse("./logs/"); return new AccessLogLocationBean(location); }
private void addAccessLog(Tomcat httpServer, StandardContext context) { try { String accessLogLocation = serverData.getRootContext().getBean(AccessLogLocationBean.class).getAccessLogLocation(); accessLogLocation = accessLogLocation + "/" + replaceSlash(serverData.getModule().getContext()) + "-access.log"; AccessLogValve accessLogValve = new AccessLogValve(); accessLogValve.setDirectory(accessLogLocation); accessLogValve.setPattern(Constants.AccessLog.COMMON_ALIAS); accessLogValve.setSuffix(".log"); accessLogValve.setRotatable(true); context.getPipeline().addValve(accessLogValve); } 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()); } }
@Bean public AccessLogLocationBean createAccessLogLocationBean( ApplicationContext rootContext) { Properties props = (Properties) rootContext.getBean("propertyFactory"); String location = Optional.ofNullable( (String) props.get("access.log.output")).orElse("./logs/"); return new AccessLogLocationBean(location); }
@Bean public AccessLogLocationBean accessLogLocationBean() { return new AccessLogLocationBean(accessLogLocation); } }