I want to create Handler that will be catch all Logs of web aplications on Tomcat, and

对着背影说爱祢 提交于 2020-01-04 06:53:45

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/16960561/i-want-to-create-handler-that-will-be-catch-all-logs-of-web-aplications-on-tomca

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!