开发者

Why would Tomcat STDOUT Always Point to /dev/null?

We're happily running three CentOS servers, each with the same application deployed on a Tomcat instance (UAT, Demo and Production). We use Log4j in the application to output to the standard CATALINA_HOME/logs/catalina.out file. This works perfectly on the UAT and Demo servers, but on the Production server we get output in this file up till the end of the startup process, but none of the application logging is ever output.

Using LSOF I can see that the STDOUT always winds up pointing to /dev/null. Even when explicitly starting Tomcat with >> $CATALINA_OUT 2>&1 & appended to it, it winds up pointing at /dev/null. I can see on the other servers it points to t开发者_开发知识库he correct catalina.out file.

I have re-deployed tomcat on the server, and have directly copied the config files from the working UAT instance, and I'm now scratching my head. Any thoughts?


How are you "starting Tomcat with >> $CATALINA_OUT 2>&1 & appended to it" ?

Are you 100% sure no one has modified bin/startup.sh or bin/catalina.sh to add the /dev/null behavior?

Unrelated to your core question, but I would strongly suggest using a log4j configuration to write to a file (FileAppender) rather than logging to standard out - this gives you options to roll the files over based on the date/size/etc, change the location, etc, very easily. Logging to standard out does not give you this flexibility.


You have a similar setup that does work correctly; the thing to do is to find out what's different about the one that doesn't. Do a diff on the following files:

  • conf/logging.properties
  • bin/startup.sh
  • bin/catalina.sh

Also compare:

  • The user that owns the Tomcat process, and the groups that the user belongs to.
  • File ownership and permissions on the logging directory.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜