Essentially we are looking for the best practices to accomplish [error handling and logging] in an object-oriented Perl application.

Logging and error handling are two separate beasts, related only in that you typically want to log errors.

I've build logging into OO and non-OO applications, and there's really not much difference (other than having a logging singleton to pass log messages to). What really matters is what you choose to log and how frequently. That'll depend entirely on your application. I typically log all user actions and any errors or warnings, then provide switches to throw to cause additional detail to be logged (such as SQL queries).

The "best practice" I can recommend is to hold a discussion session to answer the question "what kind of information are we going to need in logs to diagnose problems?" Throw a couple of realistic candidate problems onto the table, then talk through what info you'd like to see logged, and who needs to do the logging. And alway include timestamps with each log message.

I'd be careful about tying error handling and logging together, other than to make a call to the logging object from your error handling object/code.


In reply to Re: Error Handling and Logging for Object-Oriented Perl Application by dws
in thread Error Handling and Logging for Object-Oriented Perl Application by hackdaddy

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.