我想创建Handler来捕获Tomcat上所有Web应用程序的日志,并且 [英] I want to create Handler that will be catch all Logs of web aplications on Tomcat, and

查看:89
本文介绍了我想创建Handler来捕获Tomcat上所有Web应用程序的日志,并且的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个处理程序,该处理程序将捕获Tomcat上所有Web应用程序的日志, 我创建了我的Handler类,对其进行了编译并放在$CATALINA_HOME/lib上,并且common.loader具有此目录.之后,我修改了logging.properties文件并添加了处理程序:

I want to create Handler that will be catch all Logs of web aplications on Tomcat, I Created my Handler class, compiled it and put on $CATALINA_HOME/lib , and common.loader has this directory. After this I modified the logging.properties file and added the handler:

handlers = 1catalina.org.apache.juli.FileHandler, 2localhost.org.apache.juli.FileHandler, 3manager.org.apache.juli.FileHandler, 4host-manager.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler, logshowaplication.ErrorsListHandler 我放置了一些文件流,当创建对象处理程序时,它将在文件中写入一些消息. 并且当我运行tomcat时没有错误,但是当我运行它时,此消息未出现在文件中,因此不会创建Handler对象.我是Java新手,请寻求帮助.对不起,英语不好.

handlers = 1catalina.org.apache.juli.FileHandler, 2localhost.org.apache.juli.FileHandler, 3manager.org.apache.juli.FileHandler, 4host-manager.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler, logshowaplication.ErrorsListHandler I put some filestream, and when object Handler created, it will write some message in file. and there aren't mistakes when I run tomcat, but when I run it, this message isn't appear in file, therefore Handler object not creates. I'm new in Java and ask you for help. sorry for bad English.

推荐答案

将新处理程序捆绑到jar文件中.然后修改启动脚本中的类路径以包括新的处理程序罐.最后,您必须修改logging.properties中的handlers.handlers行,以包括新的处理程序.

Bundle your new handler into a jar file. Then modify the class path in the startup script to include your new handler jar. Finally, you have to modify both the handlers and the .handlers lines in the logging.properties to include your new handler.

这篇关于我想创建Handler来捕获Tomcat上所有Web应用程序的日志,并且的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆