Java – openshift Tomcat log: Catalina Out and localhost Out content

I have deployed my war application under the openshift tomcat7 cartridge

In my application, I use log4j My log4j Properties looks like:

log4j.rootCategory=info,A1,A2
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A2=org.apache.log4j.FileAppender
log4j.appender.A2.File=myapp.log
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d %p (%t) [%c] - %m%n
log4j.appender.A1.encoding=UTF-8
log4j.appender.A2.layout=org.apache.log4j.PatternLayout
log4j.appender.A2.layout.ConversionPattern=%d %p (%t) [%c] - %m%n
log4j.appender.A2.encoding=UTF-8

The problem is $openshift in my openshift application_ LOG_ There are only two log files in the dir folder:

[myapp.rhcloud.com logs]\> ls
jbossews.log  postgresql.log

In jbossews Log, I only see with Catalina Out related log lines, if the application is running under local Tomcat 7 More specifically, in jbossews Log, I see general error messages, such as:

INFO: deploying web application archive /var/lib/openshift/54...1d/app-root/runtime/dependencies/jbossews/webapps/myapp.war
Mar 05,2015 12:00:02 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
Mar 05,2015 12:00:02 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/myapp] startup Failed due to prevIoUs errors
Mar 05,2015 12:00:02 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deployment of web application archive /var/lib/openshift/54...1d/app-root/runtime/dependencies/jbossews/webapps/myapp.war has
finished in 8,867 ms

But I can't see the details of my errors, which are usually printed in localhost Local Tomcat 7 under out

So how do I configure my gear or application to view the full log? thank you.

UPD: This is not about the log level, because the part of the log I missed has an error level In addition, if I run my application under local tomcat, I can see such things

Solution

We have been facing the same problem In our example, we have a spring application that can print all logs to jbossews Log, but if one of the beans fails during startup, the error stack trace will not be printed to jbosews Log or anywhere else On Vanilla tomcat, these stack traces are printed to localhost Pay a fine We tried the accepted solution, but for some reason it didn't work

But the following tips are useful to us:

Yes openshift / config / logging. Replace in properties with:

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = 2localhost.org.apache.juli.FileHandler

With this:

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = 2localhost.org.apache.juli.FileHandler,java.util.logging.ConsoleHandler

For some reason, by adding Java util. logging. As one of the handlers, consolehandler goes to localhost.com in vanilla Tomcat Out's stack trace (and other messages) now goes to jbossews. Net in openshift log.

I hope it will help sb

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>