Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Openshift tomcat's logs: catalina.out and localhost.out contents

I have deployed my WAR application under 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 that in $OPENSHIFT_LOG_DIR folder on my openshift app there are only two log files:

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

In jbossews.log I see only that logging lines which relates to catalina.out if run application under local Tomcat 7. More specifically, in jbossews.log I see general error info, like:

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 not see details of my errors, which are usually printed on localhost.out under local Tomcat 7.

So, how I can configure my gear or application to see full log? Thanks.

UPD: This is not about log level, because parts of log which I've missed are with error level. Furthemore, I can see such things if I run my app under local tomcat.

like image 361
Andremoniy Avatar asked Feb 02 '26 16:02

Andremoniy


1 Answers

We had been facing the same issue. In our case, we had a spring app which prints all the logs fine to jbossews.log, but if one of the beans threw an error during startup, the error stack trace would not print to jbosews.log or anywhere else. On a vanilla tomcat, these stack traces would print to localhost.out fine. We had tried the accepted solution, but it would not work for some reason.

However the below trick worked for us:

In the .openshift/config/logging.properties replace this:

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.ConsoleHandler as one of the handlers, the stack traces (and other messages) that go to localhost.out in vanilla tomcat now goes to jbossews.log in openshift.

Hope this helps someone.

like image 192
user_name Avatar answered Feb 04 '26 05:02

user_name



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!