Posted on

How to customize Oracle Weblogic Logging

Although you can configure Oracle Weblogic basic logging properties by console, you might need a fine grained control over your Logging configuration. The default Oracle Weblogic Logging implementation uses Java Logging API thus, if you want to customize your loggings a step further, you need passing the logging.properties file in the -Djava.util.logging.config.file argument to the application server’s startup command:

java -Djava.util.logging.config.file=C:\mydomain\logging.properties weblogic.Server

 

As an example, take a look at the following logging.properties file where we have defined some loggers; each logger, in turn, has a level of severity, depending on its package:

# Global logging properties.  handlers=java.util.logging.FileHandler, java.util.logging.ConsoleHandler  # Default global logging level.  .level=INFO    # Loggers are usually attached to packages.  com.sample.ui.level=ALL  com.sample.business.level=CONFIG  com.sample.data.level=SEVERE   # Handlers  # Override of global logging level  java.util.logging.ConsoleHandler.level=SEVERE  java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter  # --- FileHandler ---  # Override of global logging level  java.util.logging.FileHandler.level=ALL  java.util.logging.FileHandler.pattern=%h/java%u.log  java.util.logging.FileHandler.limit=50000  java.util.logging.FileHandler.count=1  java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter