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

Wrapper Generate$ExtendedLogger name inconvenient on Linux

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.9.0
    • Component/s: None
    • Labels:
      None

      Description

      The $ExtendedLogger is interpreted as an environment variable.

      $ java -cp log4j-core-2.8.jar org.apache.logging.log4j.core.tools.Generate$ExtendedLogger \
               com.mycomp.ExtLogger DIAG=350 NOTICE=450 VERBOSE=550 > com/mycomp/ExtLogger.java
      
      Error: Main method not found in class org.apache.logging.log4j.core.tools.Generate, please define the main method 
      

      The workaround is to quote the class name:

      $ java -cp log4j-core-2.8.jar "org.apache.logging.log4j.core.tools.Generate$ExtendedLogger" \
               com.mycomp.ExtLogger DIAG=350 NOTICE=450 VERBOSE=550 > com/mycomp/ExtLogger.java
      

        Activity

        Hide
        remkop@yahoo.com Remko Popma added a comment -

        Also, improve the docs to clarify usage (http://stackoverflow.com/q/42192625/1446916).

        Show
        remkop@yahoo.com Remko Popma added a comment - Also, improve the docs to clarify usage ( http://stackoverflow.com/q/42192625/1446916 ).
        Hide
        garydgregory Gary Gregory added a comment -

        Can we just cut to the chase and give the class a decent name, maybe ExtendedLoggerGenerator? It could just turn around and call Generate$ExtendedLogger if the design for that is all good.

        Show
        garydgregory Gary Gregory added a comment - Can we just cut to the chase and give the class a decent name, maybe ExtendedLoggerGenerator ? It could just turn around and call Generate$ExtendedLogger if the design for that is all good.
        Hide
        jvz Matt Sicker added a comment -

        Outer class name for convenience sounds like a good idea.

        Show
        jvz Matt Sicker added a comment - Outer class name for convenience sounds like a good idea.
        Hide
        remkop@yahoo.com Remko Popma added a comment -

        That is what I had in mind. Sorry I wasn't clear.

        Show
        remkop@yahoo.com Remko Popma added a comment - That is what I had in mind. Sorry I wasn't clear.
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit d26353cbbb235637839820dc9366059ecec325af in logging-log4j2's branch refs/heads/master from rpopma
        [ https://git-wip-us.apache.org/repos/asf?p=logging-log4j2.git;h=d26353c ]

        LOG4J2-1814 added wrapper classes CustomLoggerGenerator and ExtendedLoggerGenerator to avoid class name with a dollar ($) character which has special meaning in many *nix command line environments

        Show
        jira-bot ASF subversion and git services added a comment - Commit d26353cbbb235637839820dc9366059ecec325af in logging-log4j2's branch refs/heads/master from rpopma [ https://git-wip-us.apache.org/repos/asf?p=logging-log4j2.git;h=d26353c ] LOG4J2-1814 added wrapper classes CustomLoggerGenerator and ExtendedLoggerGenerator to avoid class name with a dollar ($) character which has special meaning in many *nix command line environments
        Hide
        remkop@yahoo.com Remko Popma added a comment -

        Added wrapper classes CustomLoggerGenerator and ExtendedLoggerGenerator.

        Pushed to master.

        Show
        remkop@yahoo.com Remko Popma added a comment - Added wrapper classes CustomLoggerGenerator and ExtendedLoggerGenerator. Pushed to master.

          People

          • Assignee:
            remkop@yahoo.com Remko Popma
            Reporter:
            remkop@yahoo.com Remko Popma
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development