[AIX Solaris HP-UX Linux Windows][IBM i]

Limiting the growth of JVM log files using scripting

You can use scripting to configure the size of Java™ virtual machine (JVM) log files. JVM logs record events or information from a running JVM.

Before you begin

There are two ways to perform this task. This topic demonstrates how to use the AdminConfig object to modify your server configuration. Alternatively, you can use the configureJavaProcessLogs Jython script in the AdminServerManagement script library to configure the JVM log settings. The wsadmin tool automatically loads the script when the tool starts. Use the following syntax to configure JVM log settings using the configureJavaProcessLogs script:
AdminServerManagement.configureJavaProcessLogs(nodeName, serverName, processLogRoot, otherAttributeList)
For additional information and argument definitions, see the documentation for the AdminServerMananagment script library.

Procedure

  1. wsadmin 스크립트 도구를 시작하십시오.
  2. Identify the application server of interest.

    Determine the configuration ID of the application server of interest and assign it to the server1 variable, as the following example demonstrates:

    • Using Jacl:
      set s1 [$AdminConfig getid /Cell:mycell/Node:mynode/Server:server1/]
    • Using Jython:
      s1 = AdminConfig.getid('/Cell:mycell/Node:mynode/Server:server1/')
      print s1
      where:
      Table 1. Syntax explanation. The following table describes the elements of the getid command.
      Element Description
      set is a Jacl command
      s1 is a variable name
      $ is a Jacl operator for substituting a variable name with its value
      AdminConfig is an object representing the WebSphere® Application Server configuration
      getid is an AdminConfig command
      Cell is the object type
      mycell is the name of the object that will be modified
      Node is the object type
      mynode is the name of the object that will be modified
      Server is the object type
      server1 is the name of the object that will be modified
      print a Jython command
    Example output:
    server1(cells/mycell/nodes/mynode/servers/server1|server.xml#Server_1)
  3. Identify the stream log of interest.
    Determine the stream log of interest and assign it to the log variable. The following example identifies the output stream log:
    • Using Jacl:
      set log [$AdminConfig showAttribute $s1 outputStreamRedirect]
    • Using Jython:
      log = AdminConfig.showAttribute(s1, 'outputStreamRedirect')
    The following example identifies the error stream log:
    • Using Jacl:
      set log [$AdminConfig showAttribute $s1 errorStreamRedirect]
    • Using Jython:
      log = AdminConfig.showAttribute(s1, 'errorStreamRedirect')
    Example output:
    (cells/mycell/nodes/mynode/servers/server1|server.xml#StreamRedirect_2)
  4. List the current values of the stream log.
    Use the following example to display the current values of the stream log of interest:
    • Using Jacl:
      $AdminConfig show $log
    • Using Jython:
      AdminConfig.show(log)
    Example output:
    {baseHour 24}
    {fileName ${SERVER_LOG_ROOT}/SystemOut.log}
    {formatWrites true}
    {maxNumberOfBackupFiles 1}
    {messageFormatKind BASIC}
    {rolloverPeriod 24}
    {rolloverSize 1}
    {rolloverType SIZE}
    {suppressStackTrace false}
    {suppressWrites false}
  5. Modify the rotation policy for the stream log.
    The following example sets the rotation log file size to two megabytes:
    • Using Jacl:
      $AdminConfig modify $log {{rolloverSize 2}}
    • Using Jython:
      AdminConfig.modify(log, [['rolloverSize', 2]])
    The following example sets the rotation policy to manage itself. It is based on the age of the file with the rollover algorithm loaded at midnight, and the log file rolling over every 12 hours:
    • Using Jacl:
      $AdminConfig modify $log {{rolloverType TIME} 
      {rolloverPeriod 12} {baseHour 24}}
    • Using Jython:
      AdminConfig.modify(log, [['rolloverType', 'TIME'], 
      ['rolloverPeriod', 12], ['baseHour', 24]])
    The following example sets the log file to roll over based on both time and size:
    • Using Jacl:
      $AdminConfig modify $log {{rolloverType BOTH} {rolloverSize 2} 
      {rolloverPeriod 12} {baseHour 24}}
    • Using Jython:
      AdminConfig.modify(log, [['rolloverType', 'BOTH'], ['rolloverSize', 2], 
      ['rolloverPeriod', 12], ['baseHour', 24]])
  6. Save the configuration changes.
    다음 명령 예제를 사용하여 구성 변경사항을 저장하십시오.
    AdminConfig.save()
  7. In a network deployment environment only, synchronize the node.
    AdminNodeManagement 스크립트 라이브러리에 있는 syncActiveNode 또는 syncNode 스크립트를 사용하여 구성 변경사항을 노드에 전파하십시오.
    • 다음 명령 데모에 표시된 것과 같이, syncActiveNodes 스크립트를 사용하여 변경사항을 셀 내의 각 노드에 전파하십시오.
      AdminNodeManagement.syncActiveNodes()
    • 다음 명령 데모에 표시된 것과 같이, syncNode 스크립트를 사용하여 변경사항을 특정 노드에 전파하십시오.
      AdminNodeManagement.syncNode("myNode")

주제 유형을 표시하는 아이콘 태스크 주제



시간소인 아이콘 마지막 업데이트 날짜: July 9, 2016 6:14
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=txml_logrotation
파일 이름:txml_logrotation.html