• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem with Tomcat 5.5

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can someone please help me on how to get my application log file ?

Thanks in advance....

cheers
Anirban
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where did you put your application's log4j.properties file?
 
Anirban Das
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67749
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic