logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From david.we...@l-3com.com
Subject RE: Modifying logFilePath for FileAppender using a PropertyConfigurator
Date Tue, 09 Dec 2008 16:36:48 GMT
So, I answered my own question by searching a bit more on google.

The syntax is ${ENVIRONMENT_VARIABLE}/directory/fileName.txt

Now, one more question:
How does one set up the logger to create a unique log file per run.  I'm
looking at dailyRollingFileAppender, 'cause I'm pretty sure something
does what I want.

Thanks

--dw

> -----Original Message-----
> From: david.weber@l-3com.com [mailto:david.weber@l-3com.com] 
> Sent: Tuesday, December 09, 2008 10:20 AM
> To: Log4CXX User
> Subject: RE: Modifying logFilePath for FileAppender using a 
> PropertyConfigurator
> 
> Well, let's back up for a second.
> 
> Our problem, is that we need to have the log file specified 
> dynamically at runtime.  Our current mechanism, accomplishes 
> this by specifying an environment variable, having the 
> application read the environment variable, and then modifying 
> the FileAppender's file parameter.
> 
> Our current strategy, is we call configureAndWatch() on the 
> config file, modifying the file parameter using code similar 
> to below, and then calling activateOptions() to make them 
> work.  We have a problem, where we do the following actions:
> 
> 1.) File specifies the logging level to be DEBUG.  Logfile 
> writes fine.
> (expected behavior)
> 2.) File is changed to logging level of WARN.  Output to 
> logfile stops.
> (expected behavior)
> 3.) File is changed to logging level of DEBUG.  Output to 
> logfile does not resume. (unexpected behavior).
> 
> Whenever the log file is read, we get the following error:
> 
> 	"log4cxx: File option not set for appender [file]."
> 
> Because we do not specify the log file in the file, but it is 
> done at runtime.
> 
> 
> 
> Ideally, log4cxx would allow us to specify the file as:
> 
> $FOO/log_files/logfile.txt
> 
> where there exists an environment variable named FOO that 
> points to some directory, and have the FileAppender figure 
> out where to place it.
> 
> 
> 
> 
> So, based on what we're trying to do, are there any other 
> suggestions to accomplish this dynamic log-file creation at 
> runtime, with other configuration data being read from a config file?
> 
> Thanks
> 
> --dw
> 
> 
> 

Mime
View raw message