Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Jalli Venkat
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic