in reply to Log4Perl Share Signals
To alleviate this performance hit a bit, init_and_watch() can be configured to listen for a Unix signal to reload the configuration instead:Log::Log4perl::Config::Watch:This will set up a signal handler for SIGHUP and reload the configuration if the application receives this signal, e.g. via the kill command:Log::Log4perl->init_and_watch($conf_file, 'HUP');where pid is the process ID of the application.kill -HUP pid
SIGNAL MODEInstead of polling time and file changes, new() can be instructed to set up a signal handler. If you call the constructor like
then a signal handler will be installed, setting the object's variable $self->{signal_caught} to a true value when the signal arrives. Comes with all the problems that signal handlers go along with.my $watcher = Log::Log4perl::Config::Watch->new( file => "/data/my.conf", signal => 'HUP' );
|
|---|