是否可以自定义 WebSphere 访问日志(通过代码或配置)?我在控制台中看到 WebSphere 支持 NCSA 通用格式或组合格式,但没有自定义格式的选项。
我希望自定义访问日志以包含有助于调试的附加信息,例如代理、vip、LB、响应时间等。
如果不可能,我愿意接受开箱即用的想法。关键是我正在尝试获取记录的附加信息以进行调试。 log4j 是一个选项吗?也许自定义跟踪日志?
Is it possible to customize the WebSphere access logs (through code or configuration)? I see in the Console that WebSphere supports either NCSA common or combined formats, but there's no option for custom formats.
I was hoping to customize the access logs to include additional info that will assist in debugging such as proxy, vip, LB, response time, etc.
If it isn't possible, I'm open for out of the box ideas. The key is I'm trying to get additional info logged for debugging. Is log4j an option? Maybe custom trace logs?
发布评论
评论(4)
您可以做的一件事是 在 WAS 中设置一个 Web 服务器 IBM 有一个 HTTP 服务器,它只包装了 Apache,这可能会给您带来更少的麻烦,或者您可以使用 Apache, IIS等
配置完成后,您应该能够安装所需的 Apache 模块来处理自定义日志记录。其工作原理是网络服务器充当实际应用程序服务器的前端,并将请求传递给它。
One thing you could do is set up a webserver in WAS IBM has a HTTP server which just wraps Apache which will probably give you less headaches, or you can use Apache, IIS,etc.
Once configured you should be able to install required Apache modules to handle custom logging. How this works is the webserver acts as a front end to your actual application server, and passes requests to it.
自定义访问日志适用于 WAS 8.0.0.2 及更高版本。
当您愿意接受新想法时,您可以激活 servlet 的请求度量工具,如博客条目
为每个请求记录的信息都在此格式
elapsed
字段是以毫秒为单位的响应时间。Custom access log is available for WAS 8.0.0.2 onwards.
As you are open to new ideas, you may activate request metrics facility for servlet as explained in this blog entry
The informattion logged for each request is in this format
The
elapsed
field is the response time in milliseconds.一种实用的方法是创建您自己的自定义请求记录器实现。您可以使用 WAS 功能“全局 Web 容器侦听器”和标准 Servlet API ServletRequestListener 来执行此操作。
下面是一个伪示例:
}
此外,在 webcontainer 自定义属性中,您应该使用listeners 属性指向您的侦听器。
以下是有关如何配置 Web 容器侦听器的更多信息:
http://pic.dhe.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=%2Fcom.ibm.websphere.base.doc%2Finfo%2Faes%2Fae%2Frweb_custom_props.html
One practical way is to create your own customized request logger implementation. You can perform this using the WAS feature "Global webcontainer listener" with a standard Servlet API ServletRequestListener.
Here is an pseudo example:
}
Further, in the webcontainer custom properties, you should point to your listener using the listeners property.
Here is more information of how do configure a webcontainer listener:
http://pic.dhe.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=%2Fcom.ibm.websphere.base.doc%2Finfo%2Faes%2Fae%2Frweb_custom_props.html
请参阅找到的记录属性和更改跟踪文件
http://publib.boulder.ibm.com/infocenter/wchelp/v6r0m0/index.jsp?topic=%2Fcom.ibm.commerce.admin.doc%2Ftasks%2Ftlslogging.htm
另请参阅 http://publib.boulder.ibm.com/httpserv/ihsdiag/WebSphere61.html#LOG
祝你好运,
莫
Please refer to logging properties and changing trace files found
http://publib.boulder.ibm.com/infocenter/wchelp/v6r0m0/index.jsp?topic=%2Fcom.ibm.commerce.admin.doc%2Ftasks%2Ftlslogging.htm
Also see http://publib.boulder.ibm.com/httpserv/ihsdiag/WebSphere61.html#LOG
Good Luck,
Mo