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.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
|
|