use of org.apache.log4j.bridge.RewritePolicyAdapter in project logging-log4j2 by apache.
the class RewriteAppenderBuilder method createAppender.
private <T extends Log4j1Configuration> Appender createAppender(String name, String level, String[] appenderRefs, RewritePolicy policy, Filter filter, T configuration) {
org.apache.logging.log4j.Level logLevel = OptionConverter.convertLevel(level, org.apache.logging.log4j.Level.TRACE);
AppenderRef[] refs = new AppenderRef[appenderRefs.length];
int index = 0;
for (String appenderRef : appenderRefs) {
refs[index++] = AppenderRef.createAppenderRef(appenderRef, logLevel, null);
}
org.apache.logging.log4j.core.Filter rewriteFilter = buildFilters(level, filter);
org.apache.logging.log4j.core.appender.rewrite.RewritePolicy rewritePolicy;
if (policy instanceof RewritePolicyWrapper) {
rewritePolicy = ((RewritePolicyWrapper) policy).getPolicy();
} else {
rewritePolicy = new RewritePolicyAdapter(policy);
}
return new AppenderWrapper(RewriteAppender.createAppender(name, true, refs, configuration, rewritePolicy, rewriteFilter));
}
Aggregations