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

ConsoleAppender is missing @PluginFactory annotation at createAppender method

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.2
    • Component/s: Appenders
    • Labels:
      None

      Description

      I use the JUL Adapter and when j.u.l.Loggers are loaded, I get the following exception

      2014-12-28 23:01:44,113 ERROR Unable to invoke factory method in class class org.apache.logging.log4j.core.appender.ConsoleAppender for element Console. java.lang.IllegalStateException: No factory method found for class org.apache.logging.log4j.core.appender.ConsoleAppender
      	at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.findFactoryMethod(PluginBuilder.java:226)
      	at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:133)
      	at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:766)
      	at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:706)
      	at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:698)
      	at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:358)
      	at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:161)
      	at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:359)
      	at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:420)
      	at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:138)
      	at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:147)
      	at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:41)
      	at org.apache.logging.log4j.LogManager.getContext(LogManager.java:175)
      	at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:102)
      	at org.apache.logging.log4j.jul.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:34)
      	at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:42)
      	at org.apache.logging.log4j.jul.LogManager.getLogger(LogManager.java:89)
      	at java.util.logging.LogManager.demandLogger(LogManager.java:551)
      	at java.util.logging.Logger.demandLogger(Logger.java:455)
      	at java.util.logging.Logger.getLogger(Logger.java:502)
      	at org.bson.BSON.<clinit>(BSON.java:37)
      	at com.mongodb.Mongo.<clinit>(Mongo.java:74)
      	...
      

      The failing code tries to resolve the @PluginFactory annotated method, which is missing for the ConsoleAppender class.

      FileAppender's method is annotated and it works as expected. So I use this as workaround.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              gackir Robert Gacki
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: