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

Logback config not honoring system property for log level

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2.3
    • Fix Version/s: 1.3.0-alpha11
    • Component/s: logback-classic
    • Labels:
      None
    • Environment:

      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

            Assignee:
            logback-dev Logback dev list
            Reporter:
            padamstx Phil Adams
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: