Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2024-03-28 13:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found