Wednesday, July 18, 2007

Setting Trace Logging Levels in WAS 6.0 with JACL

I've recently had to change the trace logging levels in a WAS instance without the aid of the web UI. Here is the wsadmin JACL script which I used to do it:
# NOTE: Edit the following two variables for your environment
# They can be discerned from the path to your instance's bin directory
# The following shows the deployment manager ("dmgr") in the "myCell" node
set node myCell
set server dmgr

# Get up the variables required by the rest of the script
set svr [$AdminConfig getid /Node:$node/Server:$server/]
set ts [$AdminConfig list TraceService $svr]

# Modify the trace settings
# NOTE: Edit this settings string to reflect the settings you require
$AdminConfig modify $ts {{startupTraceSpecification *=warning=enabled:SystemErr=all=enabled}}

# Make the changes permanent
$AdminConfig save
To run it just save it as a file called set_trace_levels.jacl and run with the command:
./wsadmin.sh -port [SOAP port] -user [myWASAdminUID] -password [myPassword] -f set_trace_levels.jacl
NOTE: If you're on Windows, change "wsadmin.sh" to "wsadmin.bat"

No comments: