@Override public void customize(TomcatServletWebServerFactory factory) { AccessLogValve accessLogValve = findAccessLogValve(factory); if (accessLogValve == null) { return; } accessLogValve.setPrefix(customizePrefix(accessLogValve.getPrefix())); }
protected void setupAccessLogIfNeeds(Context ctx) { if (accessLogOption != null && ctx instanceof StandardContext) { // also check context type just in case final StandardContext stdctx = (StandardContext) ctx; final AccessLogValve valve = new AccessLogValve(); accessLogOption.getLogDir().ifPresent(dir -> valve.setDirectory(dir)); accessLogOption.getFilePrefix().ifPresent(prefix -> valve.setPrefix(prefix)); accessLogOption.getFileSuffix().ifPresent(suffix -> valve.setSuffix(suffix)); accessLogOption.getFileDateFormat().ifPresent(format -> valve.setFileDateFormat(format)); valve.setEncoding(accessLogOption.getFileEncoding().orElse("UTF-8")); valve.setPattern(accessLogOption.getFormatPattern().orElse("common")); accessLogOption.getConditionIf().ifPresent(cond -> valve.setConditionIf(cond)); accessLogOption.getConditionUnless().ifPresent(cond -> valve.setConditionUnless(cond)); stdctx.addValve(valve); } }
accessLogValve.setPrefix(accessLogPrefix);
accessLogValve.setPattern("%h %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-Agent}i\""); accessLogValve.setSuffix(".log"); accessLogValve.setPrefix("macgyver_access"); if (!Strings.isNullOrEmpty(conditionalLoggingAttribute)) { logger.info("configuring conditional access logging using attribute: {}",conditionalLoggingAttribute);