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:19:51 GMT
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