Logging is a very useful feature of WebLogic. Unfortunately the log levels, which are set after a clean install of WebLogic or some of the Fusion Middleware product creates a lot of noise and therefore it costs I/O performance.
Additional after analyzing an issue with logging often resetting the log level is forgotten.
Here you get a script to reset the log levels at regular intervals or after a trace session.
#!/usr/bin/python
execfile('get_environment.py') (1)
connect(wlUser, wlPassword, wlAdminUrl)
edit()
loggers = listLoggers(target=managedServer, runtime=0) (2)
for key, value in loggers.items(): (3)
if key <> "" and key <> "ADF_PERFORMANCE_MONITOR_DATABASE" and value <> "": (4)
print "set " + key + " from " + value + " to <Inherited>"
setLogLevel(target=managedServer, runtime=0, logger=key, level="")
loggers = listLoggers(target=managedServer, runtime=0) (5)
exit()
1 | a script is called to initialize your environment variables wlUser, wlPassword, wlAdminUrl and managedServer. |
2 | get the list of loggers. |
3 | iterate over this list. |
4 | you can add your own restrictions. Here are already filtered all inherited loggers and one special tool logger for performance monitoring of ADF applications. |
5 | the loggers are shown again for the result, you can remove this. |
Now call this script via
$ORACLE_HOME/oracle_common/common/bin/wlst.sh config_loglevel.py
In the output you see similar output:
------------------------------------------------------------------------+-----------------
Logger | Level
------------------------------------------------------------------------+-----------------
...
oracle.ods.virtualization.accesslog | ERROR:1
...
set oracle.ods.virtualization.accesslog from ERROR:1 to <Inherited>
------------------------------------------------------------------------+-----------------
Logger | Level
------------------------------------------------------------------------+-----------------
...
oracle.ods.virtualization.accesslog | <Inherited>
...
This version of the script change only the persistent logger levels (runtime=0), because we don’t want influence running trace sessions. But as our servers are daily started, all runtime log levels are resetted at this point to the persistent one’s.
That’s it!
References: