jwmajors81
jwmajors81

Reputation: 1430

Logging isLoggable not working in WebSphere

I'm using java.util.logging.Logger for logging within websphere and have been trying to get Logger.isLoggable to work, but it isn't working as expected. For example, if I set the logging level for a certain package to ALL, and check for whether Level.Finest is loggable it returns false and nothing is logged to the logging file.

In the table below I have defined on the first line the package level logging level within websphere. In the following lines I define possible isLoggable options and whether or not true would be returned when the package logging is set to the value specified above. Are my expectations incorrect or is the logging levels not set in the expected manner within websphere?

Package level Log Setting    ALL      FINEST   FINER     FINE    WARN      SEVERE

isLoggable(all)              Yes      No       No        No       No        No

isLoggable(finest)           Yes      Yes      No        No       No        No

isLoggable(finer)            Yes      Yes      Yes       No       No        No

isLoggable(fine)             Yes      Yes      Yes       Yes      No        No

isLoggable(warn)             Yes      Yes      Yes       Yes      Yes       No

isLoggable(severe)           Yes      Yes      Yes       Yes      Yes       Yes

Thank you very much.

Jeremy

Upvotes: 2

Views: 908

Answers (1)

Matthias Diester
Matthias Diester

Reputation: 381

I came across this question and was quite surprised why this should not be the case, since WebSphere Application Server uses standard Java Util Logging.

To test it, I wrote a quick application which created a couple of different loggers and checked them using the isLoggable() method. You can see the results below. I removed the Levels ALL and OFF to have a compact list, but they also worked as expected.

Server Info: IBM WebSphere Application Server/7.0

Package level/Log Setting  FINEST  FINER  FINE  CONFIG  INFO  WARNING  SEVERE
isLoggable(finest)         Yes     No     No    No      No    No       No
isLoggable(finer)          Yes     Yes    No    No      No    No       No
isLoggable(fine)           Yes     Yes    Yes   No      No    No       No
isLoggable(config)         Yes     Yes    Yes   Yes     No    No       No
isLoggable(info)           Yes     Yes    Yes   Yes     Yes   No       No
isLoggable(warning)        Yes     Yes    Yes   Yes     Yes   Yes      No
isLoggable(severe)         Yes     Yes    Yes   Yes     Yes   Yes      Yes

From my point of view, I would say it works as expected. Maybe there was a bug and it was solved in the meantime.

Upvotes: 1

Related Questions