Redirection of JVM system.out and system.err
 Technote (FAQ)
 
Problem
How to redirect the system.out and system.err streams of a Java™ Virtual Machine (JVM) for any server process to self-manage log files.
 
Cause
Output from a JVM process is not going to a convenient file.
 
Solution
By default, data written to the JVM system.out and system.err streams is forwarded to the process stdout and stderr streams respectively. WebSphere® Application Server supports the redirection of stdout and stderr streams to log files. The process stdout and stderr files are retained, but have no data written to them under normal operating conditions.

How to activate
  1. Shut down WebSphere Application Server.
    • All server processes must be stopped.
    • For Advanced Edition, this shut down includes both Application Server and administrative server processes.

  2. Archive the existing stdout and stderr logs for all server processes.
    • The default location these log files are located in the WASHOME/logs directory.
    • For Single Server, the default log names are default_server_stdout.log and default_server_stderr.log.
    • For Advanced Edition, the default log names are tracefile and AdminServer_stderr.log for the administrative server, and AppServerName_stdout.log and AppServerName_stderr.log for the application servers.

  3. Locate the current Reliability, Availability and Serviceability (RAS) properties file.
    • By default, this file is named logging.properties and is located in the WASHOME/properties directory. Typically, all server processes on a node share a single copy of this file.
    • If coexistence support is enabled, every server process has its own private copy of this file. Make a backup copy of all existing RAS properties files at this time.

  4. Create a copy of the logging.properties file for each server configured to use the wrapping log files.
    • It is helpful to use the server names in naming the copy.
    • For Advanced Edition, this naming convention includes both application servers and the administrative server.
    • If coexistence support is in use, each server process has two RAS properties files defined. Merge these files into a single file. The new properties file is a proper superset of the old. The new version of the RAS properties file has added properties, but none are deleted. Copy the new properties to the existing RAS properties files for each server.

  5. Change the properties setting for the System.out and System.err logs in each of the RAS properties files.

    Each of four properties for the System.out log can be modified. A similar set of properties exists for the System.err log:
    • com.ibm.ws.ras.SystemOutLogEnable
      Set this property to true, to enable this log. The default value is false.
    • com.ibm.ws.ras.SystemOutLogName
      Set this property to a unique, fully-qualified file name; for example, WASHOME/logs/ServerName_SystemOut.log. The specified file name must be a valid format for the platform. If you specify a non-default directory, create the directory before you start the server process. In addition, WebSphere Application Server must have write access to this directory.
    • com.ibm.ws.ras.SystemOutLogRollover
      Specify the maximum size of the log file, in megabytes. The default is 1 (one megabyte). This number must be positive.
    • com.ibm.ws.ras.SystemOutLogBackups
      Specify the maximum number of archive files you want to retain. The default is 1. This number must be positive.

  6. Configure each server process to use its private copy of the RAS properties file, instead of the shared (logging.properties) file. Use the com.ibm.ws.ras.RasProperties system property for this purpose. The name of the properties file that you specify using the com.ibm.ws.ras.RasProperties must be relative to the class path. Store the properties files in the properties directory, because this directory is on the class path.

    Following is an example of how to configure an Advanced Edition Single Server, an Advanced Edition administrative server, and an Advanced Edition application server to use a properties file named ServerName.properties. The ServerName.properties file resides in the WASHOME/properties directory.
    • Single Server
      1. Select the server XML configuration file in the Web console,
      2. Click Nodes > node_name > Application Servers,
      3. Click Server > Process Definition > JVM Settings,
      4. Click SystemProperties in Advanced Settings,
      5. Click New,
      6. Add com.ibm.ws.ras.RasProperties for the name field, ServerName.properties for the value field,
      7. Save the configuration.
    • Advanced Edition administrative server
      1. Edit the admin.config file in the WASHOME/bin directory.
      2. Add -Dcom.ibm.ws.ras.RasProperties=ServerName.properties to the com.ibm.ejs.sm.util.process.Nanny.adminServerJvmArgs statement.
    • Advanced Edition Application Server
      1. Start the administrative server and the administrative console,
      2. Expand nodes > node_name > Application Servers,
      3. Click Application Servers,
      4. Click JVM Settings,
      5. Click Add in System Properties.
      6. Add com.ibm.ws.ras.RasProperties for the name field, ServerName.properties for the value field,
      7. Click Apply,
      8. Verify that the generated property is correct
        -Dcom.ibm.ws.ras.RasProperties=ServerName.properties in the Generated Command Line Arguments section.

  7. Restart the Application Servers.
 
 
 


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > Java SDK
Operating system(s): HP-UX
Software version: 4.0.7
Software edition:
Reference #: 1169065
IBM Group: Software Group
Modified date: May 14, 2004