From: Mike S. <msc...@ao...> - 2002-12-02 23:13:22
|
Hi there, Kai Poitschke has brought up an interestingfeature request: Suppose, your application had a configuration "-l logfilename" option to specify the name of the log file to be used. Now, if you have an external configuration file (as opposed to a string ref passed to init()), how would you be able to adapt the config file setting in the code? He suggests to have init() overwrite certain properties of the config file like in: Dump2OWH.conf: log4perl.category.Dump2OWH = INFO, File, Screen log4perl.appender.File = Log::Dispatch::File log4perl.appender.File.filename = Dump2OWH.log log4perl.appender.File.mode = write log4perl.appender.File.layout = Log::Log4perl::Layout::PatternLayout log4perl.appender.File.layout.ConversionPattern = %d: %m%n log4perl.appender.Screen = Log::Dispatch::Screen log4perl.appender.Screen.stderr = 0 log4perl.appender.Screen.layout = Log::Log4perl::Layout::PatternLayout log4perl.appender.Screen.layout.ConversionPattern = %-5p> %m%n test.pl: # Einstellungen z.B. aus Programmflags bestimmt $more_conf = q(log4perl.appender.File.filename = test.log log4perl.appender.File.mode = append); Log::Log4perl::init('Dump2OWH.conf', $more_conf); I can see at least one other way to implement it: a not-yet-implemented-in-Log4perl feature like variables in config files (log4j has something like that but I don't think they can specify the variable replacement values via code) and a mechanism to define the placeholders in init(conf_file, key => value, key => value); Any other ideas? Sounds like a pretty useful feature to me. -- -- Mike Mike Schilli log...@pe... |