I want to check if logging is enabled for a particular level before creating the log statement. With log4j, we can do that easily as shown below
I want to do the similar thing for NonCatalogLogger. I went through the weblogic API , but could not find any direct method for this (similar to isDebugEnabled()) . I guess, there should be some way to do it... I must be missing something.. any pointers will be highly appreciated...
Joined: Jan 10, 2005
Hi Guys, I found out a way to do this... any comments/ suggestions appreciated. 1) Get the serverlogger using LoggingHelper.getServerLogger() method. 2) Get the level from this logger object. It will return a variable of type Level. 3) Downcast it to WLLevel and get the logging level against the level with which we want to log.
While your application is under development, you might find it useful to create and use messages that provide verbose descriptions of low-level activity within the application. You can use the DEBUG severity level to categorize these low-level messages. All DEBUG messages that your application generates are sent to the WebLogic Server log file. (Unlike Log4j, which is a third-party logging service that enables you to dynamically exclude log messages based on level of severity, the WebLogic Server log includes all levels of messages that your application generates.)
You also can configure the WebLogic Server to send DEBUG messages to standard out. For more information refer to "Specifying Which Messages a Server Sends to Standard Out" in the Administration Console Online Help.
If you use the DEBUG severity level, we recommend that you create a "debug mode" for your application. For example, your application can create an object that contains a boolean value. To enable or disable the debug mode, you toggle the value of the boolean. Then, for each DEBUG message, you can create a wrapper that outputs the message only if your application's debug mode is enabled.
For example, the following code can produce a debug message: