"A fool can ask more questions that a thousand wise monks can answer"

But to answer your question, I use logging for:

Reporting
If you want to know how many people visited your website, you let your web server log the connections in a log file and you use a statistics program to show you how many visitors you had per day, per month, from which area in the world, at what time of the day, etc. etc. All of this would be impossible without logging.

Debugging
Especially as a developer, you sometimes want to know what state your program is in at a particular time. You can use a debugger for that, but in some cases that is not possible or not a usable situation. One way of telling the outside world about the state of your program, is to sprinkle the code with logging statements. These can be as easy as warn statements that you add and remove when the program is production ready. Or they can be more permanent when using a logging tool such as log4perl.

Coming back to log4perl. I haven't used it (yet), but I am tempted. I only have 2 points against log4perl that I inherintly dislike:

Hope this helps.

Liz


In reply to Re: When to use logging and why? by liz
in thread When to use logging and why? by Anonymous Monk

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.