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

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Dear Monks! I am stuck with setting up DBIx::Log4perl in a database wrapper module. I am able to fire it up and all DBI methods like connect/prepare/execute are logging fine. However I'd also like the user to be able to send warnings/errors/notices into the same logfile. I'd tried a lots of ways to do it but none worked. Does anyone have a good working example of this? My init looks like the following:
my $logfile = "/tmp/sybase_wrapper_xlog_$callerfile"; Log::Log4perl::init(\ qq{ log4perl.logger.DBIx.Log4perl = DEBUG, A1 log4perl.appender.A1 = Log::Log4perl::Appender::File log4perl.appender.A1.filename = $logfile log4perl.appender.A1.mode = append log4perl.appender.A1.layout = Log::Log4perl::Layout::Pattern +Layout log4perl.appender.A1.layout.ConversionPattern=%d [%r] %P %C %p +> %H:%F{1}:%L %M - %m%n });
Then it should be something like this:
my $log = Log::Log4perl->get_logger(); $log->debug("Debug message"); $log->info("Info message"); $log->error("1234 Error message");
But it's not working. Nothing shows up in the logfile, only the messages generated by DBI. Perhaps I am missing something at the get_logger method, which I can't figure out, any suggestions? Thanks!

--
tune


In reply to DBIx::Log4perl -- how to log my own errors by tune

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, 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?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others romping around the Monastery: (4)
    As of 2020-10-26 07:13 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      My favourite web site is:












      Results (250 votes). Check out past polls.

      Notices?