Dear Monks,

I'm obviously missing something here. My log4perl.conf file looks like this :

# # Loggers # log4perl.logger.B2B::Display =ERROR, B2B_FILE log4perl.logger.B2B::Bin =TRACE, BIN_FILE, BIN_STDERR, BIN_STDO +UT # # Appenders # log4perl.appender.B2B_FILE=Log::Dispatch::File log4perl.appender.B2B_FILE.filename=/project/myproj/log/cgi/cgi.log log4perl.appender.B2B_FILE.autoflush=1 log4perl.appender.B2B_FILE.syswrite=1 log4perl.appender.B2B_FILE.utf8=1 log4perl.appender.B2B_FILE.umask=002 log4perl.appender.B2B_FILE.group=www-data log4perl.appender.B2B_FILE.mode=append log4perl.appender.B2B_FILE.min_level=debug log4perl.appender.B2B_FILE.layout=PatternLayout log4perl.appender.B2B_FILE.layout.ConversionPattern=[%P]%d{yyyyMMdd HH +:mm:ss.SSS}|%M|%L|%m%n log4perl.appender.BIN_FILE=Log::Dispatch::File log4perl.appender.BIN_FILE.filename=/project/myproj/log/bin/bin.log log4perl.appender.BIN_FILE.autoflush=1 log4perl.appender.BIN_FILE.syswrite=1 log4perl.appender.BIN_FILE.utf8=1 log4perl.appender.BIN_FILE.umask=002 log4perl.appender.BIN_FILE.group=myprojgroup log4perl.appender.BIN_FILE.mode=append log4perl.appender.BIN_FILE.min_level=error log4perl.appender.BIN_FILE.layout=PatternLayout log4perl.appender.BIN_FILE.layout.ConversionPattern=[%P]%d{yyyyMMdd HH +:mm:ss.SSS}|%M|%L|%m%n log4perl.appender.BIN_STDERR=Log::Dispatch::Screen log4perl.appender.BIN_STDERR.stderr=1 log4perl.appender.BIN_STDERR.min_level=error log4perl.appender.BIN_STDERR.layout=PatternLayout log4perl.appender.BIN_STDERR.layout.ConversionPattern=[%P]%d{yyyyMMdd +HH:mm:ss.SSS}|%M|%L|%m%n log4perl.appender.BIN_STDOUT=Log::Dispatch::Screen log4perl.appender.BIN_STDOUT.stderr=0 log4perl.appender.BIN_STDOUT.max_level=warning log4perl.appender.BIN_STDOUT.layout=PatternLayout log4perl.appender.BIN_STDOUT.layout.ConversionPattern=[%P]%d{yyyyMMdd +HH:mm:ss.SSS}|%M|%L|%m%n

I have two different class hierarchies - Display::xxx and Bin:xxx. The Display::xxx classes are instantiated by apache (www-data) and the Bin:xxx classes are instantiated by user 'x'.

The www-data and x users do not share a common group.

The problem I have is that when I create a logger for a Bin::xxx class, it tries to create the cgi.log file - even though it is only referenced by the B2B_FILE appender that Bin::xxx classes do not reference.

If user 'x' does have write access to the cgi directory, creating a logger for a Bin::xxx class does create an empty cgi.log file. If user 'x' does *not* have write access, I get a runtime permissions error saying it cannot write to .../cgi/cgi.log - even though I don't want it to.

Do I need to have separate config files for the two different types of classes?

Thanks for your help (and patience).

H.

20100504 Janitored by Corion: Added formatting, code tags, as per Writeup Formatting Tips


In reply to Question on Log4perl config file by horrendo

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.