TomcatExpert

How to redirect stderr and stdout messages

posted by SpringSource on December 28, 2009 06:05 PM

How to configure your web application's stderr and stdout messages be redirected to the application's log file for Tomcat 5.5 in ERS 3.x

For standard web applications, error messages and output are streamed to log files using sterr and stdout respectively. Some application developers prefer to aggregate all these messages into the application log.

The following steps are required to configure your web application's stderr and stdout messages be redirected to the application's log file for Tomcat 5.5 in ERS 3.1 utilizing java.util.logging:

 

1. Add the following attribute to the application context in <ERS3.1_install_dir>/servers/<server_instance>/conf/context.xml file:

swallowOutput="true" 

2. Create <ERS3.1_install_dir>/servers/<server_instance>/webapps//WEB-INF/classes/logging.properties with the following content:

handlers = org.apache.juli.FileHandler, java.util.logging.ConsoleHandler 
############################################################ 
# Handler specific properties. 
# Describes specific configuration info for Handlers. 
############################################################
org.apache.juli.FileHandler.level = FINE 
org.apache.juli.FileHandler.directory = /servers//logs 
org.apache.juli.FileHandler.prefix = jsp-examples. 
 
java.util.logging.ConsoleHandler.level = FINE 
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter 

NOTE: In the above example, the application log file with prefix jsp-examples. will be created in the server instance's logs directory.

 

3. To test the configuration, create a JSP page with the following content:

<% 
System.out.println("Test stdout"); 
System.err.println("Test stderr"); 
%> 

The stderr and stdout would continue to be logged in jvm.stdout, they are also logged in the application's log file.

 

 

For more than 10 years, SpringSource employees have been supporting Apache technologies, with unparalleled experience and commitment to the Apache Software Foundation. More than 400 of the Fortune 500 count on SpringSource to support their mission-critical business applications. Leaders of the Apache Software Foundation, including Board Members, work at SpringSource and dedicate a significant amount of time further developing the Apache Tomcat open source project. Over the last 2 years, 95% of the issues fixed in the Apache Tomcat project were fixed by SpringSource engineers. For more information on how SpringSource can help your enterprise, see the SpringSource website, or call 800/444-1935.

Comments

rfc

Can you please clarify if this /servers/ refers to a tomcat directory?
thanks

Wonderful

I am still unsure about whether “org.apache.juli.FileHandler.directory = /servers//logs” and “org.apache.juli.FileHandler.prefix = jsp-examples.“ would work well. I shall try it myself and see If it does and would recommend it for others. I think I should take a backup of what I have now before I attempt something like this. kosher restaurants la

buy twitter followers I am a

buy twitter followers I am a new user of this site so here i saw multiple articles and posts posted by this site,I curious more interest in some of them hope you will give more information on this topics in your next articles. youtube buying views

asdfsfd

Thanks for showing this awesome post APP download

and click and click and click and click

and click

trucos hungry shark

trucos hungry shark evolution I have a similar interest this is my page read everything carefully and let me know what you think. clash of clans cheats deutsch android

redirect the stdrr messages to stout messages

The provided information is really helpful me to solve my problems. This is the post which I really looking for. Your essaycenter essay writing was help me to redirect the stdrr messages to stout messages. I appreciate for you that your way of explanation which is really good. Keep posting the information like this.

SEO promotion companies

SEO promotion companies depend on keyword and key phrase vividness - an often complicated algorithm that checks to see how many of search phrases are being study by Search search engines Birthday Gift Registry.

what an amazing article.

what an amazing article.
لعبة
اقاريو
لعبة المزرعة السعيدة

Post new comment

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.