Dear brother monks,

I have a program that's supposed to be daemon. Proc::Daemon works nicely for that.

But it's also supposed to leave logs. The whole of the project (of which this daemon is just a part) uses Log::Log4perl and we are very happy with it.

However there's something in Proc::Daemon::Init() that's spoiling Log::Log4perl...

Example follows:

use Log::Log4perl qw(get_logger); use Proc::Daemon; Log::Log4perl->init_and_watch( '/tmp/test_log_daemon.conf', 10 ); # Proc::Daemon::Init(); while (1) { my $logger = get_logger('TEST'); $logger->debug("Testing..."); sleep 5; } __END__ log4perl.rootLogger = DEBUG, FileAppndr1 log4perl.logger.TEST = DEBUG log4perl.appender.FileAppndr1 = Log::Log4perl::Appender::File log4perl.appender.FileAppndr1.filename = /tmp/test_log_daemon.log log4perl.appender.FileAppndr1.mode = append log4perl.appender.FileAppndr1.umask = 0006 log4perl.appender.FileAppndr1.layout = PatternLayout log4perl.appender.FileAppndr1.layout.ConversionPattern = %d{ISO8601} % +H %p> [%c] %F{1}(%L) %M - %m%n

The contents of the config file are shown... If you tail -f the log file, as it's now, it works, but if you uncomment the Init() line, it remains quiet. Other examples, reopening STDERR and using warn and SIGHUP and other tricks, do work, but I haven't manged to make Log::Log4perl work...

Any help really appreciated... Thanks!

--
our $Perl6 is Fantastic;


In reply to Proc::Daemon and Log::Log4perl by Excalibor

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.