use of org.apache.logging.log4j.core.appender.rewrite.RewriteAppender in project syncope by apache.
the class LoggerLoader method addAppenderToContext.
public void addAppenderToContext(final LoggerContext ctx, final AuditAppender auditAppender, final LoggerConfig eventLogConf) {
Appender targetAppender = ctx.getConfiguration().getAppender(auditAppender.getTargetAppenderName());
if (targetAppender == null) {
targetAppender = auditAppender.getTargetAppender();
}
targetAppender.start();
ctx.getConfiguration().addAppender(targetAppender);
if (auditAppender.isRewriteEnabled()) {
RewriteAppender rewriteAppender = ctx.getConfiguration().getAppender(auditAppender.getTargetAppenderName() + "_rewrite");
if (rewriteAppender == null) {
rewriteAppender = auditAppender.getRewriteAppender();
}
rewriteAppender.start();
ctx.getConfiguration().addAppender(rewriteAppender);
eventLogConf.addAppender(rewriteAppender, Level.DEBUG, null);
} else {
eventLogConf.addAppender(targetAppender, Level.DEBUG, null);
}
}
Aggregations