logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Grum Ketema" <g...@cs.net>
Subject Location of log files
Date Tue, 05 Aug 2003 17:44:25 GMT
Hello

I could not find a simple solution
to this problem. I deploy a web application (a War file) in
a web server (iplanet) and an ejb application ( an ear file) in
OAS (oracle application server). I want to use log4j in both applications.
The logging works fine. The problem is specifying the location of the log
file.
I use log4j.xml to configure log4j. In there I have to specify the location
of the
log file as absolute path. This creates a problem because we have to edit
log4j.xml
during each deployment of our application to edit the location of the log
file.
I attempted to solve the problem by adding the following code in a utility
class

		rootLogger = Logger.getRootLogger();
		FileAppender fp = (FileAppender) rootLogger.getAppender("LOGFILE");
		String fileName = fp.getFile();
		String dir = getOracleRootDir();
		if (dir!=null) {
				StringBuffer logFilePath = new StringBuffer(dir);
				logFilePath.append(File.separator+"log"+File.separator+fileName);
				fp.setFile(logFilePath.toString());
				fp.activateOptions();
		}

which is kind of clumsy. Is there any way of specifying the location of the
log
file without editing log4j.xml (e.g. programmatically or otherwise)

Regards,
Grum


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org


Mime
View raw message