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

Errors in `Initialize Log4j by Combining Configuration File with Programmatic Configuration'

    XMLWordPrintableJSON

Details

    • Documentation
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.12.0
    • None
    • Documentation
    • None

    Description

      In the documentation the example for...
      https://logging.apache.org/log4j/2.x/manual/customconfig.html#Initialize_Log4j_by_Combining_Configuration_File_with_Programmatic_Configuration
      ...has a discrepancy.

      /**
      * Return the Configuration.
      * @param source The InputSource.
      * @return The Configuration.
      */
      public Configuration getConfiguration(InputSource source) {
         return new MyXMLConfiguration(source, configFile);
      }
      

      and

      public MyXMLConfiguration(final ConfigurationFactory.ConfigurationSource configSource) 
      {
        super(configSource);
      }
      

      I think what is intended is...

      @Override
      public Configuration getConfiguration(final LoggerContext loggerContext, final ConfigurationSource source)
      {
         return new FaceLoggerConfig(loggerContext, source);
      }
      

      and

      public FaceLoggerConfig(final LoggerContext loggerContext, final ConfigurationSource configSource) {
        super(loggerContext, configSource);
      }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            phreed Fredrick Eisele
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: