Search in sources :

Example 1 with RewriteAppender

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);
    }
}
Also used : Appender(org.apache.logging.log4j.core.Appender) JdbcAppender(org.apache.logging.log4j.core.appender.db.jdbc.JdbcAppender) RewriteAppender(org.apache.logging.log4j.core.appender.rewrite.RewriteAppender) MemoryAppender(org.apache.syncope.core.logic.MemoryAppender) AuditAppender(org.apache.syncope.core.logic.audit.AuditAppender) RewriteAppender(org.apache.logging.log4j.core.appender.rewrite.RewriteAppender)

Aggregations

Appender (org.apache.logging.log4j.core.Appender)1 JdbcAppender (org.apache.logging.log4j.core.appender.db.jdbc.JdbcAppender)1 RewriteAppender (org.apache.logging.log4j.core.appender.rewrite.RewriteAppender)1 MemoryAppender (org.apache.syncope.core.logic.MemoryAppender)1 AuditAppender (org.apache.syncope.core.logic.audit.AuditAppender)1