Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use java.util.logging in Weblogic?

I have an application that was migrated from Glassfish to Weblogic, and it uses java.util.logging as logging framework.

The only way I have found to make the logs work is by editing the logging.properties file of the JVM and restart the server. This solution is awkward and gives problems because the log is written to a different file than the standard ones for weblogic, so we have to look at too many files for a log in a clustered environment. Besides, for some reason this does not work on some Windows systems.

Is there a way to keep using standard java logging to write messages to weblogic's standard log files? I tried the instructions on this page but it doesn't work either.

like image 654
German Avatar asked Apr 24 '12 16:04

German


People also ask

How does Java Util Logging Work?

The System uses a Logger object to log messages. The Logger object is allocated with a LogRecord object which stores the message to be logged. This LogRecord object is forwarded to all the handlers assigned to the Logger object.

Does Oracle Weblogic use Log4j?

WebLogic Server does not provide a Log4j version in its distribution. When Log4j is enabled, you get a reference to the org. apache.

How do I enable verbose logging in Weblogic?

Select the Debug tab. Expand the scope labeled default or weblogic. Select the check box for the debug scopes or attributes you want to enable. Click Enable to enable (or Disable to disable) the debug scopes or attributes you have selected.


1 Answers

WebLogic Server ships with a JDK logging handler which will pick up log messages emitted from JDK logging framework and direct them into the WebLogic Server logging system.

Set the default logging level for new ServerLoggingHandler instances in logging.properties as well as adding the ServerLoggingHandler to the handlers.

handlers = weblogic.logging.ServerLoggingHandler
weblogic.logging.ServerLoggingHandler.level = ALL

http://docs.oracle.com/cd/E14571_01/web.1111/e13739/logging_services.htm#CHDBBEIJ

To direct the JDK logging framework to use the logging.properties file, the standard System property java.util.logging.config.file is used. With WebLogic Server, this can be easily accomplished by setting the JAVA_OPTIONS System property with the corresponding value.

$ export JAVA_OPTIONS="-Djava.util.logging.config.file=/Users/xxx/Projects/Domains/wls1035/logging.properties"

Some more hints here: http://buttso.blogspot.de/2011/06/using-slf4j-with-weblogic-server.html

like image 131
Markus Eisele Avatar answered Oct 12 '22 01:10

Markus Eisele