This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with Tomcat 5.5

 
Anirban Das
Ranch Hand
Posts: 63
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 63
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone please help me on how to get my application log file ?

Thanks in advance....

cheers
Anirban
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where did you put your application's log4j.properties file?
 
Anirban Das
Ranch Hand
Posts: 63
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64188
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 63
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic