While I generally agree with you on the importance of logging, I have a couple of comments:

A minor one first:

Built-in functions. How many times have you seen someone write: open HANDLE, ">myfile"; What if there is no space on the drive? The program will crash the first time HANDLE is written to, cause it wasn't opened successfully.

The problem is not usually a lack of space on the disk, 99% of the time it is with user rights: the file you want to write already exists and is owned by someone else.

Then something a little more philosophical:

As for logging ... it's usually the only way you know what your program has done. When I write something, it spews out tons of crap onto the screen. 99% of it, I will never use. 99% of the time, I won't use the other 1%. That 1% of the time ... My! how that 1% of the logging has saved me days of work.

I don't know about that. Code that fills the screen with useless log/warning info is just likely to make you miss the one message that was really important and that should have gotten your attention. Instead it got lost in the flow of usual crap that your program generates. So unless I can also provide the user with tools to filter the output, I usually stick to outputting only the most important warnings, while providing ways to generate additional logging if need be.


In reply to Re: Error-checking and logging by mirod
in thread Error-checking and logging by dragonchild

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.