问题描述
要求是...
我们在RHEL-5服务器中部署了3个Web应用程序,我们使用Tomcat 6.0.16部署了应用程序. 我们想配置stdout,stderr,该stderr在tomcat/logs/catalina中出现在应用程序特定日志文件中,例如,
tomcat/logs/app1.log tomcat/logs/app2.log tomcat/logs/app3.log
我们正在使用log4j,但它仅生成日志详细信息,我们需要tomcat/logs/catalina.out
的stdout app任何帮助...
推荐答案
尝试这个,
- 每个应用程序必须使用自己的log4j.您可以通过将log4j.jar放置在每个应用程序的Web-Inf/lib中来实现.
- 在每个log4j的配置文件(默认位置是Web-Inf/class)中,指定日志文件名,例如. log4j.appender.AppLog.File=${catalina.home}/logs/app1.log.
- add swallowOutput="true"对于每个上下文
我们在tomcat 5.5上这样做,但我认为它也应该在6.0上使用.
编辑:这是我们的meta-inf/context.xml,
<?xml version="1.0" encoding="UTF-8"?> <Context override="true" swallowOutput="true" useNaming="false"> <WatchedResource>WEB-INF/web.xml</WatchedResource> <Manager pathname=""/> </Context>
问题描述
Requirement is this ...
We have our 3 web-applications deployed in RHEL-5 server, we deployed apps with tomcat 6.0.16. We want to configure stdout, stderr, which are coming in tomcat/logs/catalina.out in app specific log file like,
tomcat/logs/app1.log tomcat/logs/app2.log tomcat/logs/app3.log
we are using log4j, but it is only generating logging details we need stdout per-app which is coming in tomcat/logs/catalina.out
Any Help Appreciated ...
推荐答案
Try this,
- Each application must use its own log4j. You can achieve this by placing log4j.jar in WEB-INF/lib of each application.
- In each log4j's configuration file (default location is WEB-INF/classes), specify the log file name, e.g. log4j.appender.AppLog.File=${catalina.home}/logs/app1.log.
- Add swallowOutput="true" for each context so stdout, stderr will go to your own log.
We do this on Tomcat 5.5 but I think it should work on 6.0 also.
EDIT: Here is our META-INF/context.xml,
<?xml version="1.0" encoding="UTF-8"?> <Context override="true" swallowOutput="true" useNaming="false"> <WatchedResource>WEB-INF/web.xml</WatchedResource> <Manager pathname=""/> </Context>