Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-3499

Bridge with log4j2 and log4j configuration cannot load custom appender class due to using lower case key name

    XMLWordPrintableJSON

Details

    Description

      Using log4j 1.x to log4j2 bridge with log4j2 2.17.2 and log4j properties, the customer appender that was working in log4j stops working. Upon enabling log4j debug logging, the message shown when processing the appender is:

      WARN StatusLogger Unable to load plugin class name org.abc.logging.AppAuditor with key org.abc.logging.appauditor

       

      It is trying to load the custom appender class as a plugin using the fully qualified class name in lower case. It is unable to locate the class. The system property log4j.plugin.packages was added to specify the package name where the custom appender class is located.

       

      Environment information:

      The log4j.properties file from log 4j 1.x has these entries for this custome appender:

      log4j.logger.AppAuditing = _AUDIT_LOG

      log4j.appender._AUDIT_LOG=org.abc.logging.AppAuditor

       

      The custom appender class org.abc.logging.AppAuditor extends from AppenderSkeleton and implements the custom append method.

       

      The client class using the custom appender:

      Logger log = Logger.getLogger("AppAuditing");
      log.info(message);

       

      No other changes were made to log4j.properties used with log4j 1.x and all steps were completed for log4j 1.x to log4j2 bridge migration. All other logging works as expected with the bridge except the custom appender. This custom appender AppAuditor also works without any issues in log4j 1.x. 

      Attachments

        Activity

          People

            pkarwasz Piotr Karwasz
            xb_apache_jira_user Xitiz Bhatia
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: