Trace script



Search Tips   |   Advanced Search


Sometimes we need to activate a trace level for a specific component (for example,*=all) in order to reproduce and understand an error in our application.

We can do this through the Administrative Console or using a wsadmin script.

In this appendix we provide a script which will change the runtime trace level for a specific node and a particular component. The scripts reads the trace settings from a properties file. We can add new trace specifications to the properties file as we like.

The usage is:

wsadmin -f setServerTracing.jacl server_name node properties_file trace_spec_name

For example:

wsadmin -f setServerTracing.jacl node1 node1 arfm_node

Trace Specification Name


arfm_odr Autonomic Request Flow Manager on ODR
arfm_node Autonomic Request Flow Manager on Node
charting Dynamic charting - runtime topology
dcs Distribution and consistency services, reliable multicast messaging
dwlm Dynamic workload manager
grid Business grid
ham High availability manager
odc On demand configuration
operationalpolicy Service and health policies
placement Application placement controller
proxy ODR issues
reset Reset the trace level to the default of *=info
runtime Runtime charting issues
tcp TCP channel framework
tcpdcs Combination of TCP and DCS
vizcache Visualization engine cacheservice
webcontainer Web container


Trace level change script


proc loadProperties {propFileName} {
    java::import java.util.Properties
    set fileprop [java::new Properties]
    set fileStream [java::new FileInputStream $propFileName]
    $fileprop load $fileStream
    return $fileprop
proc getTraceValue {props spec} {
    puts stdout "entering getTraceValue"
    set traceValue [string trim [$props getProperty $spec]]
        puts "properties file value for $spec is  $traceValue"
    return $traceValue

if { !($argc == 4) } {
   puts "setServerTracing: this script requires 4 parameters: server name, node name, properties file, trace specification name"
   puts ""
   puts "e.g.:   wsadmin -f  setServerTracing.jacl server1 mynode arfm"
} else {

   set serverName      [lindex $argv 0]  
   set nodeName        [lindex $argv 1]  
   set propFile        [lindex $argv 2]
   set tsn             [lindex $argv 3]

   set props [loadProperties $propFile] 
   set traceValue [getTraceValue $props $tsn]

# set up globals
  global AdminControl
  global AdminConfig
# Get the TraceService MBean for this server 
  set traceServ [$AdminControl completeObjectName type=TraceService,node=$nodeName,process=$serverName,*]
# Get the current value of traceSpecification 
  set spec [$AdminControl getAttribute $traceServ traceSpecification]
  puts "Current trace specification is $spec"
# Set it to something else 
  $AdminControl setAttribute $traceServ traceSpecification $traceValue
# Now get the current value of traceSpecification again 
  set spec [$AdminControl getAttribute $traceServ traceSpecification]
  puts "Current trace specification is now $spec"
  $AdminConfig save


Example of the properties file that is required by the script.***=all*****$Save=all*=all