aspose file tools*
The moose likes Other Open Source Projects and the fly likes How to read log4j.xml file path at runtime without hardcoding the path in Java Class...? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "How to read log4j.xml file path at runtime without hardcoding the path in Java Class...?" Watch "How to read log4j.xml file path at runtime without hardcoding the path in Java Class...?" New topic
Author

How to read log4j.xml file path at runtime without hardcoding the path in Java Class...?

Jalli Venkat
Greenhorn

Joined: Aug 10, 2006
Posts: 27
Hi Friends,

In my project , I am using log4j.xml.
I need to get path of the log4j.xml at run time without hardcoding the path in Java Class.

My Scenario: I am reading the log4j.xml file and modifying the Appender and log levels and saving the changes in the log4j.xml.
I am able to do this using hard coding the path of the log4j.xml path in my Java Class .
But i need to do that dynamically without hard coding the log4j.xml file path.

Thanks

venkat
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Your log4j.xml file simply needs to be dropped into the CLASSPATH, often if you are running on a web/app server they'll have a conf or deploy directory that is automatically added to the CLASSPATH your application is running on.


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
 
 
subject: How to read log4j.xml file path at runtime without hardcoding the path in Java Class...?