Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

struts & where to place log4j.properties

 
Prashant Mehendru
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am using log4j as my default logging system. Could you tell me if I can place log4j.properties in any folder besides the $\WEB-INF\classes\? And, if so, how? (I mean, where do I need to tell my application that it would find the properties file in "xyz" folder?)
Thanks.
 
R K Singh
Ranch Hand
Posts: 5384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can place your log4j properties file anywhere you wish.
If you place in the classes directory, then it automatically comes in the classpath and logger can find it from the classpath.
If you place your prop file anywhere else then in your initLog() method you pass the file path.
Exa:

HTH
 
Prashant Mehendru
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.
Actually, I had been looking for a default location for WebSphere. Something like the root folder where WebSphere searched first. Applying some hooks, I realized that it first read the /properties folder. So, I simply placed my log4j.properties there
Makes life much simpler And of course, efficient!
I am using the logger only for debugging purposes currently.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic