Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

I do it like this:

use Log::Log4perl; my $logfile = 'clean.log'; unlink $logfile; # ignore errors do { # Isolate # Log configuration. # If you go for interpolation, escape the {} in the pattern or use # different delimiters or something. my $lconf = q{ log4perl.logger = TRACE, ap1 log4perl.appender.ap1 = Log::Log4perl::Appender::File log4perl.appender.ap1.filename = } . $logfile . q' log4perl.appender.ap1.layout = Log::Log4perl::Layout::PatternLayou +t log4perl.appender.ap1.layout.ConversionPattern = %d{yyyyMMdd HH:mm +:ss.SSSS} %5p %F{1} %L: %m %n log4perl.appender.ap2 = Log::Log4perl::Appender::Screen log4perl.appender.ap2.layout = Log::Log4perl::Layout::PatternL +ayout log4perl.appender.ap2.layout.ConversionPattern = %d{yyyyMMdd H +H:mm:ss.SSSS} %5p %F{1} %L: %m %n '; # unclear, but this MIGHT mean something. Log::Log4perl::init ( \$lconf ) or die "Log init failed"; }; # Isolate my $logger = Log::Log4perl->get_logger('Test');
That is, by using substitution within the quoted string config.

You could also do it using function-call config, and possibly by doing a string config and then overriding that one thing with a function call, I believe, but I haven't done that, so I won't give you fake example code.

In reply to Re: log4Perl dynamic filename by dd-b
in thread log4Perl dynamic filename by fritz1968

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    [shmem]: maybe that supports ctags, check the documentation
    [Lady_Aleena]: I'd have to talk to a geany person to see.
    [Lady_Aleena]: Right now, I'm trying to decide whether I want to rewrite how variables are entered in the sub I'm working on.
    [shmem]: wait, what? you want that person to read the documentation for you?
    [Lady_Aleena]: I might have to go with options instead of a straight list.
    [Discipulus]: if more than 3 go for named variables LA
    [Lady_Aleena]: Discipulus, it is at 2 now, but with what I am thinking about, it could go to 3. However, only 1 is needed. The second and third are optional.
    [shmem]: straight list or named parameters - that depends on whether (and how many) optional arguments you have
    [Discipulus]: if so a plain list is ok, imho
    [Lady_Aleena]: shmem, I already have the plugin installed, just not active.

    How do I use this? | Other CB clients
    Other Users?
    Others meditating upon the Monastery: (12)
    As of 2017-04-27 12:19 GMT
    Find Nodes?
      Voting Booth?
      I'm a fool:

      Results (506 votes). Check out past polls.