You can configure the High Performance Extensible Logging (HPEL) log and trace framework using wsadmin scripting. Use the examples in this topic as a guide to build your own wsadmin scripts.
Variable | Description |
---|---|
myCell | The name of the cell |
myNode | The host name of the node |
myServer | The name of the server |
Changes you make using the AdminConfig object take effect the next time you start the server.
The following example shows how to change the trace specification to *=info:com.ibm.ws.classloader.*=all
HPELService = AdminConfig.getid("/Cell:myCell/Node:myNode/Server:myServer/
HighPerformanceExtensibleLogging:/")
AdminConfig.modify(HPELService, "[[startupTraceSpec *=info:com.ibm.ws.classloader.*=all]]")
AdminConfig.save()
The following example shows how to set HPEL to automatically delete the oldest log content from the log repository when the repository size approaches 65 MB. Specify HPELTrace or HPELTextLog instead of HPELLog to change the setting for the HPEL trace repository or HPEL text log.
HPELService = AdminConfig.getid("/Cell:myCell/Node:myNode/Server:myServer/
HighPerformanceExtensibleLogging:/")
HPELLog = AdminConfig.list("HPELLog", HPELService)
AdminConfig.modify(HPELLog, "[[purgeMaxSize 65]]")
AdminConfig.save()
The following example shows how to change the HPEL log repository directory name to /tmp/myDirectory. Specify HPELTrace or HPELTextLog instead of HPELLog to change the setting for the HPEL trace repository or HPEL text log.
HPELService = AdminConfig.getid("/Cell:myCell/Node:myNode/Server:myServer/
HighPerformanceExtensibleLogging:/")
HPELLog = AdminConfig.list("HPELLog", HPELService)
AdminConfig.modify(HPELLog, "[[dataDirectory /tmp/myDirectory]]")
AdminConfig.save()
HPELService = AdminConfig.getid("/Cell:myCell/Node:myNode/Server:myServer/
HighPerformanceExtensibleLogging:/")
HPELLog = AdminConfig.list("HPELLog", HPELService)
AdminConfig.modify(HPELLog, "[[bufferingEnabled false]]")
AdminConfig.save()
HPELService = AdminConfig.getid("/Cell:myCell/Node:myNode/Server:myServer/
HighPerformanceExtensibleLogging:/")
HPELLog = AdminConfig.list("HPELLog", HPELService)
AdminConfig.modify(HPELLog, "[[fileSwitchTime 15]]")
AdminConfig.modify(HPELLog, "[[fileSwitchEnabled true]]")
AdminConfig.save()
HPELService = AdminConfig.getid("/Cell:myCell/Node:myNode/Server:myServer/
HighPerformanceExtensibleLogging:/")
HPELLog = AdminConfig.list("HPELLog", HPELService)
AdminConfig.modify(HPELLog, "[[outOfSpaceAction PurgeOld]]")
AdminConfig.save()
HPELControlMBean = AdminControl.queryNames('cell=myCell,node=myNode,
type=HPELControlService,process=myServer,*')
AdminControl.setAttribute(HPELControlMBean, "traceSpecification",
"*=info:com.ibm.ws.classloader.*=all")
HPELLogDataMBean = AdminControl.queryNames('cell=myCell,
node=myNode,type=HPELLogDataService,process=myServer,*')
AdminControl.setAttribute(HPELLogDataMBean, "purgeMaxSize", "65")
HPELLogDataMBean = AdminControl.queryNames('cell=myCell,
node=myNode,type=HPELLogDataService,process=myServer,*')
AdminControl.setAttribute(HPELLogDataMBean, "dataDirectory", "/tmp/myDirectory")
HPELLogDataMBean = AdminControl.queryNames('cell=myCell,node=myNode,
type=HPELLogDataService,process=myServer,*')
AdminControl.setAttribute(HPELLogDataMBean, "bufferingEnabled", "false")
HPELLogDataMBean = AdminControl.queryNames('cell=myCell,node=myNode,
type=HPELLogDataService,process=myServer,*')
AdminControl.setAttribute(HPELLogDataMBean, "fileSwitchTime", "15")
AdminControl.setAttribute(HPELLogDataMBean, "fileSwitchEnabled", "true")
HPELLogDataMBean = AdminControl.queryNames('cell=myCell,node=myNode,
type=HPELLogDataService,process=myServer,*')
AdminControl.setAttribute(HPELLogDataMBean, "outOfSpaceAction", "PurgeOld")