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

    • Type: Documentation
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.12.0
    • Fix Version/s: None
    • Component/s: Documentation
    • Labels:
      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

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

              Dates

              • Created:
                Updated: