File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

load log4j property file from url

 
Rohit David
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have figured out how to load a property file from a url and use the PropertyResourceBundle to get the properties. However once loaded how do I make this property file visible to the application? Is there some log4j object I can call and provide it with reference to the property file accessed from url? Any help would be appreciated.

The reason for me to do this is because its getting very inconvenient to make changes to log4j prop file from a WAR file and it always involved re-deploying and restarting application. Instead having a prop file in a remote location, which can be accessed by the application using url makes things much easier to use and make changes. If there is another approach to doing what I would like to do without using url methodology then kindly state.

I am currently using tomcat 5.5 and eventually I would be deploying this app to Websphere.

Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64171
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The easiest way I've found to setup Log4J with Tomcat is to simply place the file in $CATALINA_HOME/common/classes

This places it at the root of the classpath of all web apps and it automatically gets picked up.
 
Rohit David
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This would work great and i would have used this approach, but the problem is we have like 5 enviornments (dev, test, prod, train, stage) and each one has its own app server. It would just make it so much simple to load the file from a url. This way one copy of the prop is used in all 5 env. And this is what I am trying to do and would like some assistance. I have the code to load a prop file from url, but once I get access to this file how do I make the setting visibile to the application.

However thanks for your help.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic