|
From: Mike S. <m...@pe...> - 2012-04-18 02:07:29
|
On Tue, 17 Apr 2012, Gangemi, Jae wrote:
> am i missing something w/ this idea or will i need to re-initialize
> log4perl w/ a new configuration in order to make this work?
You're not saying how your call into the system works, I presume that
you're using a signal handler or some such to run a function that
manipulates the logger on a received signal. Then, somehow Log4perl gets
reinitialized by calling init() and it's back to normal. With mod_perl,
this happens e.g. when Apache starts a new child process, I suspect
something similar is happening in your embedded system.
I wonder why you're not simply using init_and_watch() and modify the
external config file to regularly check and reload it?
--
-- Mike
Mike Schilli
m...@pe...
> hello -
>
> i'm currently running log4perl inside an embedded instance, for all
> intents and purposes, you could say it's an environment similar to
> mod_perl.
>
> while the system is running, i would like to send a command that changes
> the log level of either the root logger or against one of the logger
> categories (and potentially dynamically adding an appender so i can log to
> a separate file.
>
> the problem i am having the log level does not persist between calls
> into the system. i can make a call in and change the log level (and log a
> message at the new level to make sure it worked) but on a subsequent call,
> the log level has been reset to what log4perl was originally initialized
> with, i.e.:
>
> $logger = Log::Log4perl->get_logger("");
>
> $logger->fatal("fatal message");
> $logger->trace("trace message, should not see");
>
> $logger->level($TRACE);
> $logger->level("trace message, should see");
>
|