故障诊断的资源
1.1 确定WebSphere产品安装信息
1.1.1 确定WAS产品信息
sh <was_home>/bin/versionInfo.sh
more <was_home>/properties/version/WAS.product,此文件包含WebSphere Application Server产品相关信息.
more <profile_home>/logs/server1/SystemOut.log
1.1.2 确定JDK的版本信息
more <profile_home>/logs/server1/SystemOut.log
<was_home>/java/bin/java -fullversion
1.1.3 确定Web服务器的版本信息
C:\Program Files\IBM HTTP Server\bin>apache -v (Windows)
httpd -v (Unix/Linux)
1.2 管理控制台消息(Administrative console messages)
运行时事件
运行时事件>消息详细信息
1.3 使用日志文件
1.3.1 JVM日志
System.out 日志可用于问题确定。System.err 日志包含异常堆栈跟踪信息,这在执行问题分析时很有用。
1.3.3 进程日志
缺省情况下,在应用程序服务器启动时重定向 stdout 和 stderr 流到日志文件,
其包含由本机模块(.dll、.exe、UNIX 库和其他模块)写入 stdout 和 stderr 流的文本。
缺省情况下,这些文件存储为logs/applicationServerName/native_stderr.log 和 native_stdout.log。
1.3.5 服务日志(Service log)
服务日志是用二进制格式写的特殊日志。
您可以两种方式查看服务日志:
1)建议使用日志分析器工具来查看服务日志。此工具提供互操作式查看和分析能力,此能力在识别问题方面很有用。
2)也可使用 Showlog 工具将服务日志的内容转换成接下来您可写到文件或转储到命令外壳程序窗口的文本格式。
要运行 showlog 脚本:
在服务日志驻留的机器上打开 shell 窗口。
sh /installation_root/bin/showlog activity.log (将服务或活动日志(activity.log)内容导向标准输出)
要转储服务或活动日志到文本文件以便使用文本编辑器查看,就使用 showlog activity.log textFileName 命令
1.4 使用跟踪
如果您不熟悉 WebSphere Application Server 的内部结构,则跟踪输出可能对您没有意义。
默认情况下,所有WebSphere Application Server组件的traces是关闭的
1.4.1 服务器启动时启用跟踪
记录和跟踪>日志和跟踪>server1>诊断跟踪服务
SERVER_LOG_ROOT/trace.log
1.5 检测 J2EE 应用程序中的挂起线程
J2EE 应用程序中的一个常见错误是挂起线程。
挂起线程可能由于简单软件缺陷(例如,无限循环)或更复杂的原因(例如,资源死锁)导致。
1.5.1 挂起时间阈值的自动调节
1.5.2 调整运行中服务器的挂起检测策略
使用 wsadmin 脚本接口调整线程监控设置,更改会立即生效,但不会保存在服务器配置中,服务器重启时会丢失。
以下脚本提供了一个示例,说明如何使用 wsadmin 工具调整线程监控的属性:
# Read in the interval, threshold, false alarm from the command line
set interval [lindex $argv 0]
set threshold [lindex $argv 1]
set adjustment [lindex $argv 2]
# Get the object name of the server you want to change the values on
set server [$AdminControl completeObjectName "type=Server,*"]
# Read in the interval and print to the console
set i [$AdminControl getAttribute $server threadMonitorInterval]
# Read in the threshold and print to the console
set t [$AdminControl getAttribute $server threadMonitorThreshold
# Read in the false alarm adjustment threshold and print to the console
set a [$AdminControl getAttribute $server threadMonitorAdjustmentThreshold]
# Set the new values using the command line parameters
$AdminControl setAttribute $server threadMonitorInterval ${interval}
$AdminControl setAttribute $server threadMonitorThreshold ${threshold}
$AdminControl setAttribute $server threadMonitorAdjustmentThreshold ${threshold}
2.诊断故障的工具
2.1日志分析器
Log Analyzer是一个图形化的工具,用来帮助用户查看、分析日志的。
2.1.1 运行 Log Analyzer
sh <was_home>/bin/waslogbr
2.1.2 更新symptom database
通过Analyzer Log下载最新的symptom database。
1)WAServer or Express, 选择 File -> Update Database -> WebSphere Application Server Symptom Database.
2) 对于 WebSphere Application Server Network 选择 File -> Update Database -> Application Server Network Deployment