Configuring applications to generate log files

Applications such as Apache HTTP Server, IBM WebSphere Application Server, IBM DB2 Universal Database, and IBM HTTP Server can be configured to generate logs in a format that is suitable for parsing with the log parsers.

Here is a list of application configurations that help to format logs so they can be parsed by the parsers that are supplied with the tools.

Note: Log events that are contained in these log files can be analyzed using a symptom database to interpret known events and error conditions. A symptom database is used to find detailed information about error resolution and event significance. For more information on symptom databases and instructions on importing and using them, see the related topics at the end of this file.

Configuration for Apache HTTP Server activity and trace log file for iSeries

The Apache configuration file is named /www/apachedft/conf/httpd.conf on the iSeries server. It should have the following directives in order to properly enable the access and error logs:

# ErrorLog: The location of the error log file. If this does not start
# with /, ServerRoot is prepended to it.

ErrorLog ./logs/error.log

# LogLevel: Control the number of messages logged to the error.log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.

LogLevel warn

# The following directives define some format nicknames for use with
# a CustomLog directive (see below).

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

# The location of the access logfile (Common Logfile Format).
# If this does not start with /, ServerRoot is prepended to it.


CustomLog ./logs/access.log common

The two sections in bold text above define where the Apache error log and access logs are located respectively. In this case, for example, with ServerRoot as /www/apachedft, the logs would appear in subdirectory /www/apachedft/logs/ and be respectively named error.log.* and access.log.*. The final suffix on the filename will be date-dependent (e.g. the first error.log.for December 31, 2003 may be named something like Q103123100).

After you have changed the Apache configuration file, you must restart the Apache server to reflect this change. From the OS400 command line, enter STRTCPSVR SERVER(*HTTP) INSTANCE(APACHEDFT)

Conversely, ending the Apache server can be done with the following command in the OS400 command line: ENDTCPSVR SERVER(*HTTP) INSTANCE(APACHEDFT)

Configuration for IBM WebSphere Application Server V4.0 activity log file

  1. Edit the following entries in the <WAS_HOME>\properties\logging.properties logging configuration file:
     #-----------------------------------------------------------------------------------------------
     # Activity Log Properties
     #
     # WARNING Before changing any of the Activity Log properties, all servers on the physical
     # node, including AdminServers must be stopped. 
     #
     # com.ibm.ws.ras.AcvitityLogEnabled : A property used to determine whether or not the servers on 
     # this node will write Ras events to the activity log or not. Valid values are true and false, 
     # with true the default. Turning off this logging may have serious serviceability impacts.
     #
     # com.ibm.ws.ras.ActivityLogSize : Size of the activity log in kilobytes. The default value
     # is 1024, which yields a log size of 1 megabyte. See the Problem Determination guide for
     # guidelines on setting the size of this log.
     #------------------------------------------------------------------------------------------------
    

    com.ibm.ws.ras.ActivityLogEnabled=true
    com.ibm.ws.ras.ActivityLogSize=1024


  2. Save the changes to the configuration file.
  3. Restart the application server.

Notes:

Configuration for IBM WebSphere Application Server V4.0 trace log file (standalone Administrative Console)

  1. Open the IBM WebSphere Application Server Administrative Console.
  2. Select WebSphere Administrative Domain > Nodes > node_name > Application Servers > server_name > Services > Trace Service, where node_name is the name of the node and server_name is the name of the server to which the trace log configuration will be applied.
  3. Double-click the server_name and choose the Services tab.
  4. Highlight the Trace Service and click Edit Properties.
  5. Click Browse and select the groups or components, or a combination of both, to trace.
  6. Ensure that the following components are enabled as shown:

    com.ibm.ws.http.HttpConnection=entry
    Exit=enabled:
    com.ibm.ws.webcontainer.srp.ServletRequestProcessor=entry
    Exit=enabled,
    event=enabled


  7. Click OK.
  8. Set the Trace File to a local file path.
  9. Click OK.
  10. Save changes to the configuration.
  11. Restart the application server.

Configuration for IBM WebSphere Application Server V4.0 trace log file (servlet-based Administrative Console)

  1. Open the IBM WebSphere Application Server Administrative Console.
  2. Select WebSphere Administrative Domain > Nodes > node_name > Application Servers > server_name > Trace Service, where node_name is the name of the node and server_name is the name of the server to which the trace log configuration will be applied.
  3. Enable the Trace String and add the desired components to be traced.
  4. Ensure that the following components are enabled as shown:

    com.ibm.ws.http.HttpConnection=entry
    Exit=enabled:
    com.ibm.ws.webcontainer.srp.ServletRequestProcessor=entry
    Exit=enabled,
    event=enabled


  5. Set the Trace File to a local file path.
  6. Click OK.
  7. Save changes to the configuration.
  8. Restart the application server.

Configuration for IBM WebSphere Application Server V5.0 or V6.0 activity log file

  1. Open the IBM WebSphere Application Server Administrative Console.
  2. Select Troubleshooting > Logs and Trace > server_name > IBM Service Logs, where server_name is the name of the node to which the activity log configuration will be applied.
  3. Enable service log.
  4. Set the File Name to a local file path.
  5. Click Apply or OK.
  6. Save the changes to the configuration.
  7. Restart the application server.

Note: By default, ${LOG_ROOT} is WAS_HOME\logs\ where WAS_HOME is the following:

Configuration for IBM WebSphere Application Server V5.0 or V6.0 trace log file

  1. Open the IBM WebSphere Application Server Administrative Console.
  2. Select Troubleshooting > Logs and Trace > server_name > Diagnostic Trace, where server_name is the name of the node to which the trace log configuration will be applied.
  3. Enable Trace and add the desired Trace Specification.
  4. Ensure that the following components are enabled as shown:

    For V5.0:

    com.ibm.ws.http.HttpConnection=entry
    Exit=enabled:
    com.ibm.ws.webcontainer.srp.ServletRequestProcessor=entry
    Exit=enabled,
    event=enabled

    For V6.0:

    com.ibm.ws.http.HttpConnection=entry
    Exit=enabled:
    com.ibm.ws.webcontainer.srp.ServletRequestProcessor=entry
    Exit=enabled,
    event=enabled
    com.ibm.ws.http.HttpConnection=finer:com.ibm.ws.webcontainer.srp.ServletRequestProcessor=finer
  5. Set the Trace Output File to a local file path.
  6. Click Apply or OK.
  7. Save the changes to the configuration.
  8. Restart the application server.

Note: By default, ${SERVER_LOG_ROOT} is WAS_HOME\logs\server_name\ where server_name is the name of the node to which the trace log configuration will be applied and WAS_HOME is the following:

Configuring the size of WebSphere Application Server trace log file

  1. Open the IBM WebSphere Application Server Administrative Console.
  2. Select Troubleshooting > Logs and Trace > server_name > Diagnostic Trace.
  3. Under Trace Output, select select File, and enter the desired the desired maximum file size. The recommended size of the trace log file should be less than 10MB.
  4. Click Apply to save the changes.
  5. Restart the application server.

Configuration for IBM WebSphere Application Server for z/OS error log file

IBM WebSphere Application Server for z/OS can be configured to write error log events to a log stream or to the SYSOUT dataset of the WebSphere Application Server MVS job. Follow the instructions below to copy the error log events to a file that can be parsed and imported into the Log Analyzer. The Log Analyzer can parse and import both V4.0 and V5.0 WebSphere Application Server for z/OS error log files.

Note: IBM WebSphere Application Server for z/OS error log files cannot be imported from MVS datasets. They must be in the UNIX System Services file system

Note: The times in the error log events are parsed as GMT time. You must configure WebSphere Application Server for z/OS to write GMT times in the error log events. That is the default configuration. If it is configured to write local times in the error log events, the timezone information shown in the creationTime property of the log events in the Log View will be incorrect.

Note:IBM WebSphere Application Server for z/OS error log files can only be associated by time.

Configuration for IBM HTTP Server V1.3.19.3 to V2.0.42.1 access log file

  1. Edit the following entry in the IHS_HOME\conf\httpd.conf HTTP server configuration file:

       # The location of the access logfile (Common Logfile Format).
       # If this does not start with /, ServerRoot is prepended to it.
       CustomLog logs/access.log common
  2. Save the changes to the configuration file.
  3. Restart the HTTP Server.

Notes:

Configuration for IBM HTTP Server V1.3.19.3 to V2.0.42.1 error log file

  1. Edit the following entry in the IHS_HOME\conf\httpd.conf HTTP server configuration file:
       # ErrorLog: The location of the error log file. If this does not start
       # with /, ServerRoot is prepended to it.
       ErrorLog logs/error.log
       # LogLevel: Control the number of messages logged to the error.log. 
       # Possible values include: debug, info, notice, warn, error, crit, alert, emerg. 
       LogLevel warn
  2. Save the changes to the configuration file.
  3. Restart the HTTP Server.

Notes:

Configuration for IBM DB2 Universal Database V8.1 to V8.2 diagnostic log file

The default configuration of DB2 writes all error and warning messages to a log file called db2diag.log. This file is located in the following location:

For supported Windows environments:

For UNIX-based environments: INSTHOME/sqllib/db2dump, where INSTHOME is the home directory of the instance owner.

The DIAGPATH variable, specified in the database manager configuration, gives the fully qualified path to the first failure data capture (FFDC) storage directory. The default value for DIAGPATH is a null string. To change the DIAGPATH value, use the following command:

DB2 UPDATE DBM CFG USING DIAGPATH path

Verifying the current diagnostic error capture level

Follow these steps:

  1. Open a DB2 Command Window.
  2. Type
    db2 get dbm cfg
  3. Read the value of "Diagnostic error capture level (DIAGLEVEL)".

Configuring the amount of evented information

The amount of information being written to the diagnostic log file (db2diag.log) can be configured by following these steps:

  1. Open a DB2 Command Window.
  2. Type:
    db2 update dbm cfg using DIAGLEVEL [level]
    where [level] is the value that controls the amount of information to be written. The default value is 3. Valid values and their meanings are as follows:
    0 = No diagnostic data captured
    1 = Severe errors only
    2 = All errors
    3 = All errors and warnings
    4 = All errors, warnings and informational messages
  3. If the value is updated, the change will take effect immediately.

Configuration for IBM DB2 Universal Database V8.1.2 or V8.2 JCC trace log file (Web application running in WebSphere Application Server)

The WebSphere Application Server Administrative Console enables you to configure how information related to JDBC is evented. There are two ways to event JCC log messages:

  1. Direct all JCC messages to the WAS V5.0 trace log file.
  2. Direct all JCC messages to a separate log file.

Directing JCC messages to the WAS V5.0 trace file

Follow these steps:

  1. Open the IBM WebSphere Application Server V5.0 Administrative Console.
  2. Select Troubleshooting > Logs and Trace > server_name > Diagnostic Trace.
  3. Click the Modify button under Trace Specification. A window opens.
  4. Under the Groups tab, ensure that the following groups are selected:
    1. WAS.database
    2. WAS.j2c
    3. RRA
  5. Click the Apply button. The window closes.
  6. Click Apply in the Configuration tab of the main window.
  7. Save the changes to the configuration.
  8. Select Resources > JDBC Providers > DB2 Universal JDBC Driver Provider > Data Sources > data_source_name > Custom Properties.
  9. In the Custom Properties table, ensure that the traceFile property is not set.
  10. If a file name is specified under traceFile, click on traceFile. Remove the text in the Value field, and click OK.
  11. Save the changes to the custom properties.
  12. Restart the application server.

Directing JCC messages to a separate log file

Follow these steps:

  1. Open the IBM WebSphere Application Server V5.0 Administrative Console.
  2. Select Troubleshooting > Logs and Trace > server_name > Diagnostic Trace.
  3. Click on the Modify button under Trace Specification. A window opens. Under the Groups tab of the small window, ensure the RRA group is selected.
  4. Click the Apply button. The window closes.
  5. Click Apply in the Configuration tab of the main window.
  6. Save the changes to the configuration.
  7. Select Resources > JDBC Providers > DB2 Universal JDBC Driver Provider > Data Sources > data_source_name > Custom Properties.
  8. Under the Name column of the Custom Properties table, click on traceFile.
  9. Type the absolute path of the trace file in the Value field, and click OK.
  10. Under the Name column of the Custom Properties table, click on traceLevel.
  11. Enter the appropriate traceLevel value in the Value field. Possible trace levels and their meanings are documented in the Description property, right below the Value field.
  12. Click OK.
  13. Save the changes to the custom properties.
  14. Restart the application server.

Configuration for IBM DB2 Universal Database V8.1.2 or V8.2 JCC trace log file (standalone application)

For JDBC 2 connectivity from the data source, use the setLogWriter() and setTraceLevel() methods on the com.ibm.db2.jcc.DB2SimpleDataSource object. These methods fully enable the default trace level.

You can enable JDBC 1 tracing with the driver manager java.sql.DriverManager.setLogWriter(), or alternatively a traceFile can be embedded in a JDBC 1 database URL.
For example:
String databaseURL = "jdbc:db2://hal:50000/sample:traceFile=c:/temp/foobar.txt;traceLevel=" + (com.ibm.db2.jcc.DB2BaseDataSource.TRACE_DRDA_FLOWS | com.ibm.db2.jcc.DB2BaseDataSource.TRACE_CONNECTS) + ";";


 

For both JDBC 1 and JDBC 2 connectivity, you can turn trace on and off on a connection by using the proprietary method DB2Connection.setJCCLogWriter(java.io.PrintWriter logWriter, int traceLevel). You can also use this method to change the log writer or to adjust the trace level on an active connection. If you use the standard javax.sql.DataSource.setLogWriter(java.io.PrintWriter logWriter)method, the default (fully enabled) trace level is used. You can disable tracing by setting the log writer to null.

For further details on creating trace information for the Universal JDBC driver, refer to the DB2 documentation.

Once you have completed any of the above set of tasks, that particular log file can be imported into your product (File > Import...).

Configuration for IBM DB2 Universal Database CLI and JDBC trace files

CLI and JDBC trace file location

If the TraceFileName keyword was used in the db2cli.ini file to specify a fully qualified file name, then the DB2 CLI trace log file will be in the location specified. If a relative file name was specified for the DB2 CLI trace log file name, the location of that file will depend on what the operating system considers to be the current path of the application.

Note:
If the user executing the application does not have sufficient authority to write to the trace log file in the specified path, no file will be generated and no warning or error is given.

If either or both of the TracePathName and JDBCTracePathName keywords were used in the db2cli.ini file to specify fully qualified directories, then the DB2 CLI and DB2 JDBC trace log files will be in the location specified. If a relative directory name was specified for either or both trace directories, the operating system will determine its location based on what it considers to be the current path of the application.

Note:
If the user executing the application does not have sufficient authority to write trace files in the specified path, no file will be generated and no warning or error is given. If the specified trace path does not exist, it will not be created.

The DB2 CLI and DB2 JDBC trace facilities automatically use the application's process ID and thread sequence number to name the trace log files when the TracePathName and JDBCTracePathName keywords have been set. For example, a DB2 CLI trace of an application with three threads might generate the following DB2 CLI trace log files: 100390.0, 100390.1, 100390.2.

Similarly, a DB2 JDBC trace of a Java(TM) application with two threads might generate the following JDBC trace log files: 7960main.trc, 7960Thread-1.trc.

Note:
If the trace directory contains both old and new trace log files, file date and time stamp information can be used to locate the most recent trace files.

If no DB2 CLI or DB2 JDBC trace output files appear to have been created:

Configuration for IBM WebSphere Application Server for iSeries activity and trace log file

IBM WebSphere Application Server for iSeries allows multiple server instances each with its own configuration. The subdirectory where the instance is defined will depend on both the version of IBM WebSphere Application Server installed on the server and the server instance name.

For example, if you wanted to see the logging settings on an iSeries machine running IBM WebSphere Application Server Express V5.0 for a server instance named default, the server.xml file would be stored in the following location:

/QIBM/UserData/WebASE/ASE5/default/config/cells/myhostname/nodes/mynodename/servers/server1/server.xml. 

This server.xml file contains the specifications for logging.

  1. Turn on activitly log generation.
    The activity logging is turned on by default, in the following clause:
    <services xmi:type="loggingservice.ras:RASLoggingService" xmi:id="RASLoggingService_1" enable="true" messageFilterLevel="NONE" enableassociationId="true">
    <serviceLog xmi:id="ServiceLog_1" name="${LOG_ROOT}/activity.log" size="2" enabled="true"/>
    </services>
    

    The activity log (according to the above example) would appear in the file /QIBM/UserData/WebASE/ASE5/default/logs/activity.log.

  2. Turn on IBM WebSphere Application Server trace log.
    The trace logging is not turned on by default. You may need to edit the server.xml file to turn tracing on by adding the following 3 lines:
    <services xmi:type="traceservice:TraceService" xmi:id="TraceService_1" enable="true" startupTraceSpecification="com.ibm.ws.http.HttpConnection=entryExit=enabled:com.ibm.ws.webcontainer.srp.ServletRequestProcessor=entryExit=enabled,event=enabled" traceOutputType="SPECIFIED_FILE" traceFormat="BASIC" memoryBufferSize="8">
    <traceLog xmi:id="TraceLog_1" fileName="${SERVER_LOG_ROOT}/trace.log" rolloverSize="20" maxNumberOfBackupFiles="1"/>
    </services>
    

    According to the example above, this will create a trace log in file /QIBM/UserData/WebASE/ASE5/default/logs/server1/trace.log.

  3. Stopping and restarting IBM WebSphere Application Server instance to commit changes
    This can be done either from the command line or from the IBM WebSphere Application Server administration console. To stop the server from command line, the following commands should be issued from the iSeries QShell interpreter. 1. Change the current directory to the applicable IBM WebSphere Application Server bin directory 2. Stop the server
    stopServer -instance default

    3. Restart the server

    startServer -instance default

Related concepts
Determining problems in distributed applications using the Log and Trace Analyzer
Autonomic Computing symptom databases

Related tasks
Importing a log file
Importing and using an AC symptom database