WLST Script to enabe Log4j Logger on a weblogic server
Switch from Java Logging to Log4j via WLST
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
-
C:\>java weblogic.WLST
-
# connect Administration Server
-
wls:/offline> connect(‘uname’,‘password’)
-
# Start an edit session and navigating to the logging mbean for the server names myserver
-
wls:/mydomain/serverConfig> edit()
-
wls:/mydomain/edit> startEdit()
-
wls:/mydomain/edit !> cd(“Servers/myserver/Log/myserver”)
-
# enable log4j
-
wls:/mydomain/edit/Servers/myserver/Log/myserver !> cmo.setLog4jLoggingEnabled(true)
-
#save and activate the changes
-
wls:/mydomain/edit/Servers/myserver/Log/myserver !> save()
-
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.