Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2007

Tip: Looking for answers? Try searching our database.

tomcat log4j

Thread view: 
simonC - 31 Jul 2007 09:51 GMT
I use log4j for logging in my java web application. I use Tomcat as a
servlet container. The problem is that both the output of Tomcat
logging and my web application logging is send to stdout and the
output becomes very messy.

I would like that the loging of tomcat would not be output to stdout.
So that in stdout i would have only logs of my web application.

Hou can I set up Tomcat to achive that?
Lew - 31 Jul 2007 12:12 GMT
> I use log4j for logging in my java web application. I use Tomcat as a
> servlet container. The problem is that both the output of Tomcat
[quoted text clipped - 5 lines]
>
> Hou can I set up Tomcat to achive that?

Set up a log4j.properties file that directs logging output where you want it
to go.

Signature

Lew

Roedy Green - 31 Jul 2007 13:54 GMT
>Set up a log4j.properties file that directs logging output where you want it
>to go.
It will have a line in it something like this:
log4j.appender.A.File=a.log
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Mark Jeffcoat - 31 Jul 2007 20:58 GMT
>> I use log4j for logging in my java web application. I use Tomcat as a
>> servlet container. The problem is that both the output of Tomcat
[quoted text clipped - 8 lines]
> Set up a log4j.properties file that directs logging output where you
> want it to go.

Specifically, to get a handle on what Tomcat sends to
stdout, you need to tell log4j what to do with org.apache.catalina
log messages. E.g.,

<log4j_fragment>
 <appender name="tomcat_log" class="org.apache.log4j.RollingFileAppender">
    [configure this appender...]
 </appender>
 
 <logger name="org.apache.catalina">
   <level value="info" />
   <appender-ref ref="tomcat_log" />
 </logger>
</log4j_fragment>

(I use log4j.xml instead of log4j.properties, since log4j's
configuration is so thoroughly hierarchal. Just a minor matter
of taste; if you have an existing log4j.properties, it should
be simple enough to translate this example into that format.)

Signature

Mark Jeffcoat
Austin, TX



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.