Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Because the Log4perl configuration file format requires each configuration item to be on a single line. You can continue a line onto the next line by ending it in a backslash, or you can just type it out as one really long line. If you review the documentation on CPAN again, you will notice that all of the examples use very short subs, and none of them span more than one line.

The method I normally use for approaching this is something like...

# config file log4perl.logger.ClassA = DEBUG, ClassA log4perl.appender.ClassA = Log::Log4perl::Appender::File log4perl.appender.ClassA.filename = sub { log_filename() } # in the main code use POSIX 'strftime'; sub log_filename { return strftime( "/tmp/ClassA%Y%m%d.log", localtime ); } Log::Log4perl::init_and_watch('/etc/log4perl.conf',5); my $mylog = Log::Log4perl->get_logger();

We're not surrounded, we're in a target-rich environment!

In reply to Re^3: log file in Log4perl by jasonk
in thread log file in Log4perl by palette

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (2)
As of 2024-04-25 19:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found