Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-1519

Logback config not honoring system property for log level

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 1.5.7
    • 1.2.3
    • logback-classic
    • None
    • Linux Fedora 32, java 8, command-line app with loggers displaying on console

    Description

      I have a java application that is run from the command line. I have my logback.xml file configured to display all messages on the console.

      In my logback.xml file, I have configured my logger like this:

       <logger name="com.ibm.sdk.codegen" level="${SDKGEN_LOGLEVEL:-INFO}">
         <appender-ref ref="STDOUT"/>
         <appender-ref ref="STDERR"/>
       </logger>
      
      

       

      I want the default log level to be INFO, but I also would like to allow users to specify "-DSDKGEN_LOGLEVEL=DEBUG" as part of the java command to enable debug logging.

       

      I'm following these instructions on how to do this, but I can't seem to get this to work.  I have some debugging code in my application that verifies the system property is being set as expected:

      [INFO ] c.i.s.c.IBMDefaultCodegen: SDKGEN_LOGLEVEL=DEBUG this.class=IBMJavaCodegen
      

       

      But logback-classic seems to not want to use that system property value.   What am i doing wrong? 

       

      I'll attach my full logback.xml file to this issue for reference.

       

      Attachments

        Activity

          People

            ceki Ceki Gülcü
            padamstx Phil Adams
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: