Amit,
As far as I know there is no other alternative without mentioning
path of the file. But ofcourse you can eliminate doing this changes again and
again.
There are basically two ways you can do this.
First
====
You can define an environmental variable in your system with the path of the
file. Followed by this you can add a class ( "AppLoader.java") in your
application which will read the path from the environment variable.
Second
======
You write two porperty files one for each dev and test server . Go to
< $Catalina Home>/commons/classes/
Drop your log4j.properties ( respective server). Then go to
< $Catalina Home>/commons/lib/
Drop jar file name " log4j.jar" here .
Thats it .....
Cheers
Anirban
----- Original Message ----
From: "Rajpurkar, Amit {PI}" <[EMAIL PROTECTED]>
To: [email protected]
Sent: Friday, 17 August, 2007 7:10:33 AM
Subject: Problem with Location of the log file
Hi,
I have just started to user Log4j.
The logging is working good. I have one problem -- I want to make the
output log file location portable, rather than dependent on each
machine.
In the configuration file I have
log4j.appender.R.File=D:/Documents and
Settings/ARajpur/.netbeans/5.5.1/apache-tomcat-5.5.17_base/logs/applicat
ionLogs_VFM.log
When ever I deploy my applocation to test server, I need to modify it to
log4j.appender.R.File=E:/java/Tomcat 5.0/logs/applicationLogs_VFM.log
Is there any way in which I don't have to hard code the file path on
different machines??
Thanks and Regards,
-Amit
THIS ELECTRONIC MAIL MESSAGE AND ITS CONTENTS ARE INTENDED ONLY FOR THE USE OF
THE ADDRESSED RECIPIENT(S) AND MAY CONTAIN INFORMATION THAT IS PRIVILEGED,
CONFIDENTIAL, AND EXEMPT FROM DISCLOSURE UNDER APPLICABLE LAW. IF YOU ARE NOT
AN INTENDED RECIPIENT, OR THE AGENT RESPONSIBLE FOR DELIVERING THIS EMAIL TO
THE INTENDED RECIPIENT(S), YOU ARE HEREBY NOTIFIED THAT ANY USE, DISSEMINATION,
DISTRIBUTION, OR COPYING OF THIS COMMUNICATION IS STRICTLY PROHIBITED AND MAY
BE UNLAWFUL. IF YOU RECEIVED THIS EMAIL IN ERROR, PLEASE NOTIFY THE SENDER
IMMEDIATELY BY REPLYING TO THIS EMAIL OR BY TELEPHONE, AND DELETE THE EMAIL
SENT IN ERROR
Did you know? You can CHAT without downloading messenger. Go to
http://in.messenger.yahoo.com/webmessengerpromo.php/