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