Example: Migrating - Setting the server trace specification

  • wscp V4.0

    DrAdmin remote <portno> -setTrace com.ibm.ejs.*=all=enabled
    

  • wsadmin V6.x

    There are two ways to set tracing with wsadmin in V6.x. The following way takes immediate effect, but is temporary and is set on the runtime, using the AdminControl object:

    Jacl

    set ts [$AdminControl queryNames type=TraceService,node=nodeName,process=serverName,*]
    $AdminControl setAttribute $ts traceSpecification com.ibm.*=all=enabled
    

    Jython

    ts = AdminControl.queryNames('type=TraceService,node=nodeName,process=serverName,*')
    AdminControl.setAttribute(ts, 'traceSpecification', 'com.ibm.*=all=enabled')
    

    If you want your changes to persist, change the configuration by using the AdminConfig object, for example:

    Jacl

    set svr [$AdminConfig getid /Node:nodeName/Server:serverName/]
    set ts [$AdminConfig list TraceService $svr]
    $AdminConfig modify $ts {{startupTraceSpecification com.ibm.*=all=enabled}}
    $AdminConfig save
    

    Jython

    svr = AdminConfig.getid('/Node:nodeName/Server:serverName/')
    ts = AdminConfig.list('TraceService', svr)
    AdminConfig.modify(ts, [['startupTraceSpecification', 'com.ibm,*=all=enabled']])
    AdminConfig.save()
    

    We can also change the TraceLog specifications, for example:

    Jacl

    set svr [$AdminConfig getid/Node:nodeName/Server:serverName/]
    set ts [$AdminConfig list TraceService $svr]
    set trlog [$AdminConfig list TraceLog $ts]
    $AdminConfig modify $trlog {{fileName myFile.log} {maxNumberOfBackupFiles 10} {rolloverSize 2}}
    $AdminConfig save
    

    Jython

    svr = AdminConfig.getid('/Node:nodeName/Server:serverName/')
    ts = AdminConfig.list('TraceService' svr)
    trlog = AdminConfig.list('TraceLog', ts)
    AdminConfig.modify(trlog, [['fileName' 'myFile.log'], ['maxNumberOfBackupFiles' 10], ['rolloverSize' 2]])
    AdminConfig.save()