use of org.sonar.process.logging.LogbackHelper in project sonarqube by SonarSource.
the class TomcatAccessLog method configureLogbackAccess.
private static void configureLogbackAccess(Tomcat tomcat, Props props) {
if (props.valueAsBoolean(PROPERTY_ENABLE, true)) {
ProgrammaticLogbackValve valve = new ProgrammaticLogbackValve();
LogbackHelper helper = new LogbackHelper();
LogbackHelper.RollingPolicy policy = helper.createRollingPolicy(valve, props, "access");
FileAppender appender = policy.createAppender("ACCESS_LOG");
PatternLayoutEncoder fileEncoder = new PatternLayoutEncoder();
fileEncoder.setContext(valve);
fileEncoder.setPattern(props.value(PROPERTY_PATTERN, DEFAULT_SQ_ACCESS_LOG_PATTERN));
fileEncoder.start();
appender.setEncoder(fileEncoder);
appender.start();
valve.addAppender(appender);
tomcat.getHost().getPipeline().addValve(valve);
}
}
Aggregations