Having trouble with a config file for Log::Log4Perl. Here's what I am trying to accomplish: Here's what I have so far. (It doesn't work -- only the error log is created.)
log4perl.logger = DEBUG, FD, S log4perl.logger = INFO, FI log4perl.logger = ERROR, FE log4perl.appender.S = Log::Log4perl::Appender::Screen log4perl.appender.S.stderr = 0 log4perl.appender.S.layout = Log::Log4perl::Layout::SimpleLayout log4perl.appender.FD=Log::Log4perl::Appender::File log4perl.appender.FD.filename=/home/perl_logs/debug.log log4perl.appender.FD.mode=append log4perl.appender.FD.layout = Log::Log4perl::Layout::PatternLayout log4perl.appender.FD.layout.ConversionPattern = %d %p: %m %F{1}(%L) +%n log4perl.appender.FI=Log::Log4perl::Appender::File log4perl.appender.FI.filename= log4perl.appender.File.filename = \ sub {my $p = $0; $p =~ s{(\w+)\.\w+$}{/home/perl_logs/$1.txt}; ret +urn $p;} log4perl.appender.FI.mode=append log4perl.appender.FI.layout = Log::Log4perl::Layout::PatternLayout log4perl.appender.FW.layout.ConversionPattern = %d %p -- %m %n log4perl.appender.FE=Log::Log4perl::Appender::File log4perl.appender.FE.filename=/home/perl_logs/fatal.log log4perl.appender.FE.mode=append log4perl.appender.FE.layout = Log::Log4perl::Layout::PatternLayout log4perl.appender.FE.layout.ConversionPattern = %d %p: %m %F{1}(%L) +%n
I put a simple wrapper around Log::Log4Perl like this
package MyLog; use strict; use warnings FATAL => qw( all ); use Carp::Assert; use Data::Dumper; use base qw(Exporter); use vars qw(@EXPORT); @EXPORT = qw(get_logger $INFO $DEBUG $WARN $ERROR $FATAL); use Log::Log4perl qw(:levels); BEGIN { Log::Log4perl->init('/home/foo/log4perl-conf.txt'); } sub get_logger { Log::Log4perl::get_logger(@_); } 1;
Thanks for any suggestions...

water

You could not step twice into the same river; for other waters are ever flowing on to you. -- Heraclitus


In reply to help with Log::Log4perl config file by water

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.