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

Main Arguments Lookup not working

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.1
    • 2.4
    • Lookups
    • None
    • Windows 7 x64, Java Batch Application

    Description

      It is not possible to use the Main Arguments Lookup in the current version. The "main" prefix is not present in the corresponding Interpolator object and thus the resolution of the variable is not working as advertised in the documentation, e.g. using the following variable in the log4j2.xml:

      ${main:0}

      As far as I can tell, the problem seems to stem from the PluginManger.collectPlugins-Method that does not acknowledge the existence of the Main Arguments Lookup.

      I'm following the documentation on the website with the following sample log4j2.xml:

      <File name="GLOBAL" fileName="${env:DATA_DIR}/log/${env:APP_NAME}.log" >
         <PatternLayout pattern="%m%n" header="File: ${main:0}" />
          ...
      

      ...and following code in my application:

      public static void main(String[] args) {
          MapLookup.setMainArguments(args);
          ...
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            johannes.siebel@debeka.de Johannes Siebel
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: