Uploaded image for project: 'JBoss Logging'
  1. JBoss Logging
  2. JBLOGGING-131

Logger.getEffectiveLevel() not working correctly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor Minor
    • None
    • None
    • jboss-logging-log4j
    • None
    • Hide

      First you need to add this logging configuration in your standalone.xml:

      <logger category="de.der.sample.business">
      <level name="TRACE"/>
      </logger>

      A test webservice project is attached. Deploy it and call the webservice using SoapUI or any test client. You will see the values returned by getEffectiveLevel() and also isTraceEnabled() and isDebugEnabled(). The isLevelEnabled() methods return correctly but getEffectiveLevel() sometimes returns TRACE and sometimes DEBUG. You may need to redeploy several times to see both values.

      Show
      First you need to add this logging configuration in your standalone.xml: <logger category="de.der.sample.business"> <level name="TRACE"/> </logger> A test webservice project is attached. Deploy it and call the webservice using SoapUI or any test client. You will see the values returned by getEffectiveLevel() and also isTraceEnabled() and isDebugEnabled(). The isLevelEnabled() methods return correctly but getEffectiveLevel() sometimes returns TRACE and sometimes DEBUG. You may need to redeploy several times to see both values.
    • Workaround Exists
    • Hide

      Instead of using Logger.getEffectiveLevel() and checking the level, you can use Logger.isDebugEnabled() or the analogous method for whichever level you are concerned with.

      Show
      Instead of using Logger.getEffectiveLevel() and checking the level, you can use Logger.isDebugEnabled() or the analogous method for whichever level you are concerned with.

      The Logger.getEffectiveLevel() method doesn't seem to return correct values.

      In a test, we set the log level for a category to TRACE and the method sometimes returns TRACE and sometimes returns DEBUG. Whichever value is returns stays the same until the next time the application is deployed at which point it may change.

      The same behavior seems to exist as well on EAP 7.0 and EAP 6.4.

              rhn-support-iweiss Ingo Weiss
              rhn-support-iweiss Ingo Weiss
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: