Monday, January 18, 2010

WLST Script to enabe Log4j Logger on a weblogic server

WebLogic logging services use an implementation based on the Java Logging APIs, by default. Using the LogMBean.isLog4jLoggingEnabled attribute, you can direct the logging services to use Log4j instead.

Posted by Unni# Start WLST

  1. C:\>java weblogic.WLST
  2.  
  3. # connect Administration Server
  4. wls:/offline> connect('uname','password')
  5.  
  6. # Start an edit session and navigating to the logging mbean for the server names myserver
  7. wls:/mydomain/serverConfig> edit()
  8. wls:/mydomain/edit> startEdit()
  9. wls:/mydomain/edit !> cd("Servers/myserver/Log/myserver")
  10.  
  11. # enable log4j
  12. wls:/mydomain/edit/Servers/myserver/Log/myserver !> cmo.setLog4jLoggingEnabled(true)
  13.  
  14. #save and activate the changes
  15. wls:/mydomain/edit/Servers/myserver/Log/myserver !> save()
  16. wls:/mydomain/edit/Servers/myserver/Log/myserver !> activate()

Java Logging is the default for client and server-side logging; Log4j is available only for server-side and not client-side logging.

1 comments:

  1. Hi,

    Will it be possible to modify logmbean using WLST Offline.

    Thanks
    Srinivasan

    ReplyDelete