将“日志和跟踪分析器”与 iSeries 日志配合使用

在 iSeries 上,有 4 种类型的日志可以导入“日志和跟踪分析器”:

配置 Apache Server 以进行记录

在 iSeries 服务器上,Apache 配置文件命名为 /www/apachedft/conf/httpd.conf。它应该具有下列伪指令才能正确启用访问日志和错误日志:

# 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

上面粗体文本的两部分分别定义了 Apache 错误日志和访问日志的位置。例如,在此示例中,当 ServerRoot 是 /www/apachedft 时,日志将出现在子目录 /www/apachedft/logs/ 中且名称分别为 error.log.* 和 access.log.*。文件名的最终后缀将与日期相关(例如,对于 2003 年 12 月 31 日的第 1 个 error.log 可命名为类似于 Q103123100 之类的名称)。

在更改了 Apache 配置文件之后,必须重新启动 Apache 服务器以刷新此更改。从 OS400 命令行中,输入
STRTCPSVR SERVER(*HTTP) INSTANCE(APACHEDFT)

反之,可以在 OS400 命令行中使用以下命令结束 Apache 服务器:
ENDTCPSVR SERVER(*HTTP) INSTANCE(APACHEDFT)

配置 WebSphere Application Server 以进行记录

因为 WebSphere Application Server for iSeries 允许多个服务器实例,所以每个实例都将具有它自己的配置,因此定义这一点的子目录将取决于安装在服务器上的 WebSphere 的版本和服务器实例名称。例如,如果想要为命名为缺省值的服务器实例查看运行 WebSphere Application Server Express V5.0 的 iSeries 机器上的记录设置,则 server.xml 文件将存储在以下位置:

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

此 server.xml 文件包含用于记录的规范。缺省情况下,在以下子句中,活动日志是打开的:

<services xmi:type="loggingservice.ras:RASLoggingService" xmi:id="RASLoggingService_1" enable="true" messageFilterLevel="NONE" enableCorrelationId="true">
<serviceLog xmi:id="ServiceLog_1" name="${LOG_ROOT}/activity.log" size="2" enabled="true"/>
</services>

活动日志(按照上面的示例)将出现在文件 /QIBM/UserData/WebASE/ASE5/default/logs/activity.log 中。

缺省情况下,WebSphere Application Server 的跟踪日志不是打开的。可能需要通过添加下列 3 行来编辑 server.xml 文件以打开跟踪:

<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>

按照上面的示例,这将在文件 /QIBM/UserData/WebASE/ASE5/default/logs/server1/trace.log 中创建跟踪日志。

将需要停止受影响的 WebSphere Application Server 实例,然后重新启动它以使任何配置更改生效。这可以从命令行进行,也可以从 WebSphere Application Server 管理控制台进行。从命令行停止服务器(例如,如果服务器实例名称是缺省值)将对 iSeries Qshell 解释器发出下列命令(在将当前目录切换至适用的 WebSphere Application Server bin 目录之后,例如,对于 WebSphere Application Server Express V5,目录将是 /QIBM/ProdData/WebASE/ASE5/bin)

stopServer -instance default

要重新启动服务器,再次在 QShell 中输入

startServer -instance default

相关概念
使用“日志和跟踪分析器”确定分布式应用程序中的问题
公共基本事件模型
症状数据库

相关任务
设置记录首选项

相关参考
“日志”视图