Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

You don't need logging, if this world is perfect, and you don't bother to remember anything. However that's not the case. Here are things I usually log for my applications:

  • As the world is not perfect, we programmers make mistakes. Logging can help you to determine what happened, thus help you to understand why it happened. You can log all kinds of helpful debug informations. Examples are:
    • SQLCODE of failed (or successful) database operations;
    • Failed SQL statement (this is especially useful when the SQL statement is dynamically generated)
    • Messages that help you to determine the actually execution path (where you have branches, loops, entering subs, exiting subs..)
    • The actual parameters being passed to a sub
    • ...
  • Logging also can be used to audit activities going on in your system, things like connections, failed connections, attacks, user activities...;
  • Many times, I log stuffs that could help me to determine the performance of a particular code block, things like the time the block is entered, the time the block is exited.
  • You can log various statistics data of you application. Things like: number of records actually being updated by a SQL statement...
  • ...

An application without proper loggings is just like a black box. You don't know what is going on. You don't know whether something is actually happening. When something went wrong, you don't know what was wrong...

So it is really for your own benefit, to create proper logging and the right amount of logging.

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

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
    Domain Nodelet?
    and the web crawler heard nothing...

    How do I use this?Last hourOther CB clients
    Other Users?
    Others surveying the Monastery: (4)
    As of 2024-07-24 20:48 GMT
    Find Nodes?
      Voting Booth?

      No recent polls found

      erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.