| Author |
Problem with Tomcat 5.5
|
Anirban Das
Ranch Hand
Joined: Nov 22, 2003
Posts: 63
|
|
Iam using Tomcat as webserver for my Struts(1.3.8) web application For getting localhost logging I have followed the instruction @ "http://tomcat.apache.org/tomcat-5.5-doc/logging.html" It solved Tomcat logging problem but Iam not getting my application log which I have configured through a seperate log4j.properties file. My application has environment configuration file as follows Neither Iam seeing System.out.println() statements in tomcat console nor Iam able to see the log file in the mentioned in log4j.properties file The log4j.properties file written for my web application is as follows log4j.appender.A2.layout.ConversionPattern=%-5p %d{ISO8601} %c [%t] - %m%n
|
 |
Anirban Das
Ranch Hand
Joined: Nov 22, 2003
Posts: 63
|
|
Can someone please help me on how to get my application log file ? Thanks in advance.... cheers Anirban
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
|
Where did you put your application's log4j.properties file?
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
Anirban Das
Ranch Hand
Joined: Nov 22, 2003
Posts: 63
|
|
Ben, Thanks for your response. Well I have put the log4j.properties under my <Application Workspace>/config directory. Iam loading the log4j.properties file by using a static method (known as loadProps()) which is coded in the class "EnvConfiguration" As my application requires to read the configuration file from folder name config in the workspace I have kept it there and tried to load it at starting of the app itself. Just to mention I have also tried to put it under <WEB-INF> directory but met with no success.  Cheers Anirban
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
I'm not a log4j guru but I'll tell you what I do. I put log4j.properties in WEB-INF/classes. That's it.
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
Originally posted by Anirban Das: Just to mention I have also tried to put it under <WEB-INF> directory but met with no success.
Tomcat does not look in WEB-INF when building your application's classpath. It looks in WEB-INF/lib for jar files and in WEB-INF/classes.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56200
|
|
Loading it yourself is like jumping through hoops of fire. Why do it? If you want the properties to only apply to a particular web app, put it where Ben indicated. I like my settings to apply not only to all my web apps, but to the logging performed by Tomcat itself, so I place mine in $CATALINA_HOME/common/classes.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
If you're interested, I just put together a war file that is configured to use log4j to write to TOMCAT-INSTALL/logs/SimpleLog4j.log. It's up on my server but hasn't been tested except on my machine just now. http://simple.souther.us/SimpleLog4j.war Try it if you like. If it works for you, then I'll consider it tested and put up some links to it. -Ben
|
 |
Anirban Das
Ranch Hand
Joined: Nov 22, 2003
Posts: 63
|
|
Ben, Sorry for that typo. What I mean't that time was putting log4j.properties under <WEB-INF>/classes and log4j-1.2.8.jar under <WEB-INF>/lib directory Cheers Anirban
|
 |
 |
|
|
subject: Problem with Tomcat 5.5
|
|
|