Configuring HPEL with wsadmin scripting

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.

About this task

HPEL provides faster log and trace handling capabilities and more flexible ways to use log and trace content than the basic mode. You can configure the HPEL mode using the administrative console, or using wsadmin scripting. The examples in this topic show how to configure HPEL using wsadmin. If you complete this task using the deployment manager, then you might need to synchronize the node agent on the target node and restart the server before configuration changes take effect.
Table 1. Variable Names . The table applies to all examples in this topic. All examples use the Jython scripting language.
Variable Description
myCell The name of the cell
myNode The host name of the node
myServer The name of the server

Procedure

  • Use the AdminConfig object to configure HPEL.

    Changes you make using the AdminConfig object take effect the next time you start the server.

    1. Change the trace specification.

      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()
    2. Change the size of the log repository.

      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()
    3. Change the log repository location.

      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()
    4. Disable log record buffering.

      The following example shows how to change the HPEL log repository to not use log record buffering. 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, "[[bufferingEnabled false]]")
      AdminConfig.save()
      
      Best practice: Enable log record buffering in almost all cases. Only disable log record buffering when your server is failing unexpectedly and cannot write buffered content to disk before stopping.
    5. Start writing to a new log file each day at a specified time.

      The following example shows how to enable the HPEL log repository to start a new log file each day at 3pm. 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, "[[fileSwitchTime 15]]")
      AdminConfig.modify(HPELLog, "[[fileSwitchEnabled true]]")
      AdminConfig.save()
    6. Change the out of space action for the log repository.

      The following example shows how to change the out of space action for the HPEL log repository. 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, "[[outOfSpaceAction PurgeOld]]")
      AdminConfig.save()
  • Use the AdminControl object to configure HPEL.
    Changes you make using the AdminControl object take effect immediately.
    1. Change the trace specification.

      The following example shows how to change the trace specification to *=info:com.ibm.ws.classloader.*=all

      HPELControlMBean = AdminControl.queryNames('cell=myCell,node=myNode,
      type=HPELControlService,process=myServer,*')
      AdminControl.setAttribute(HPELControlMBean, "traceSpecification", 
      "*=info:com.ibm.ws.classloader.*=all")
    2. Change the size of the log repository.

      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 HPELTraceDataService or HPELTextLogService instead of HPELLogDataService to change the setting for the HPEL trace repository or HPEL text log.

      HPELLogDataMBean = AdminControl.queryNames('cell=myCell,
      node=myNode,type=HPELLogDataService,process=myServer,*')
      AdminControl.setAttribute(HPELLogDataMBean, "purgeMaxSize", "65")
    3. Change the log repository location.

      The following example shows how to change the HPEL log repository directory name to /tmp/myDirectory. Specify HPELTraceDataService or HPELTextLogService instead of HPELLogDataService to change the setting for the HPEL trace repository or HPEL text log.

      HPELLogDataMBean = AdminControl.queryNames('cell=myCell,
      node=myNode,type=HPELLogDataService,process=myServer,*')
      AdminControl.setAttribute(HPELLogDataMBean, "dataDirectory", "/tmp/myDirectory")
    4. Disable log record buffering.

      The following example shows how to change the HPEL log repository to not use log record buffering. Specify HPELTraceDataService or HPELTextLogService instead of HPELLogDataService to change the setting for the HPEL trace repository or HPEL text log.

      HPELLogDataMBean = AdminControl.queryNames('cell=myCell,node=myNode,
      type=HPELLogDataService,process=myServer,*')
      AdminControl.setAttribute(HPELLogDataMBean, "bufferingEnabled", "false")
      Best practice: Enable log record buffering in almost all cases. Only disable log record buffering when your server is failing unexpectedly and cannot write buffered content to disk before stopping.
    5. Start writing to a new log file each day at a specified time.

      The following example shows how to enable the HPEL log repository to start a new log file each day at 3pm. Specify HPELTrace or HPELTextLog instead of HPELLog to change the setting for the HPEL trace repository or HPEL text log.

      HPELLogDataMBean = AdminControl.queryNames('cell=myCell,node=myNode,
      type=HPELLogDataService,process=myServer,*')
      AdminControl.setAttribute(HPELLogDataMBean, "fileSwitchTime", "15")
      AdminControl.setAttribute(HPELLogDataMBean, "fileSwitchEnabled", "true")
    6. Change the out of space action for the log repository.

      The following example shows how to change the out of space action for the HPEL log repository. Specify HPELTraceDataService or HPELTextLogService instead of HPELLogDataService to change the setting for the HPEL trace repository or HPEL text log.

      HPELLogDataMBean = AdminControl.queryNames('cell=myCell,node=myNode,
      type=HPELLogDataService,process=myServer,*')
      AdminControl.setAttribute(HPELLogDataMBean, "outOfSpaceAction", "PurgeOld")

Results

HPEL is now configured. If you made changes with the AdminConfig command, restart the server to make the changes take effect.