Search Results


Friday, February 12, 2016

Configure Weblogic ODL logger

How to configure weblogic ODL logger

Log files in the weblogic server could be managed using Log Configuration UI in the enterprise manager console (em console). We could configure rotation policies and log levels etc straight from the UI. Here are the steps to configure a custom ODL logger.

Steps

  • Goto em console http://host:port/em
  • Navigate to WebLogic Domain > DefaultDomain > DefaultServer
  • Rightclick on DefaultServer and select Logs > Log Configuration
  • Log Levels tab allows for log level configuration
  • Choose "Loggers with persistant log level state"
  • Scroll down to the bottom of the page and expand "Specify Loggers"
  • Enter the name of the class "pras.soa.business" and choose log level (e.g. INFO)
  • Click on Apply button to save the settings.

  • Log files tab lets the user configure the log file handler for the selected log levels
  • Click on Create button
  • Enter the following details
    • Name: prasloghandler
    • Log path: ${domain.home}/servers/${weblogic.Name}/logs/${weblogic.Name}-pras.log
    • Log Level: INFO
    • Loggers to associate: pras.soa.business
    • Choose a rotation policy based on your needs.
  • Click ok to finish.



Now everytime when a class in pras.soa.business package uses java logging, it gets logged in the DefaultServer-pras.log file.

Here is an example java code

Java Example

//Import
import java.util.logging.Logger;

//Class variables
private static final Logger log = Logger.getLogger("pras.soa.business.test");


//Code in methods
log.info("this is a test")




Post a Comment