Class LoggerNameLevelRewritePolicy

java.lang.Object
org.apache.logging.log4j.core.appender.rewrite.LoggerNameLevelRewritePolicy
All Implemented Interfaces:
RewritePolicy

@Plugin(name="LoggerNameLevelRewritePolicy", category="Core", elementType="rewritePolicy", printObject=true) public class LoggerNameLevelRewritePolicy extends Object implements RewritePolicy
Rewrites log event levels for a given logger name.
Since:
2.4
  • Method Details

    • createPolicy

      @PluginFactory public static LoggerNameLevelRewritePolicy createPolicy(@PluginAttribute("logger") String loggerNamePrefix, @PluginElement("KeyValuePair") KeyValuePair[] levelPairs)
      Creates a policy to rewrite levels for a given logger name.
      Parameters:
      loggerNamePrefix - The logger name prefix for events to rewrite; all event logger names that start with this string will be rewritten.
      levelPairs - The levels to rewrite, the key is the source level, the value the target level.
      Returns:
      a new LoggerNameLevelRewritePolicy
    • rewrite

      public LogEvent rewrite(LogEvent event)
      Description copied from interface: RewritePolicy
      Rewrite a logging event.
      Specified by:
      rewrite in interface RewritePolicy
      Parameters:
      event - a logging event that may be returned or used to create a new logging event.
      Returns:
      a logging event or null to suppress processing.