How to read log4j.xml file path at runtime without hardcoding the path in Java Class...?
posted 6 years ago
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.
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.