Hi Julius,

I asked about best practice a while back, so it's good to see this come up
again as I am still trying to get and idea on what "best practice" is with
regards to logging.

I agree with avoiding multiple-lines, but there are occasions where this
simply isn't possible.  These should really only be at the DEBUG level and
are probably a candidate to go into a separate log file to avoid cluttering
up the main one.

I have three other pet hates with logging
1) Log messages which only make sense with the code as a reference.  These
are simply useless to the support team. e.g. "strThing populated".  Really.
How very nice.  What the heck is "strThing" and why should I care?  A better
message may be something like "Thing set to 'x' from table 'y'".  Every
developer should ask themselves "Will this message help or confuse the
support team when they see it?"  Certainly for the ERROR and INFO levels.

2) Log messages which hide information.  "The file could not be found."
What file?  Where?  Do I even know why it was being accessed?  The log
message should always contain the file path (or meaningful relative path)
and the name.  The same holds true to other connections don't log
"Connection refused", log "Connection to 'xyz' refused".  Again, this all
about helping the support team.

3) DEBUG is for developers.  Higher levels are for the support team and
(possibly) client admins.  Don't forget!  In my experience may developers do
and log technical stuff at these higher levels which is just confusing and
means the support team cannot do their job and have to push work back onto
engineering to decipher.

I am more than likely guilty of all 3!

Cheers,

J.

-----Original Message-----
From: Julius Davies [mailto:[EMAIL PROTECTED] 
Sent: 06 June 2008 05:28
To: [email protected]
Subject: log4j best practises

Here's a page of what I consider log4j best practises:

http://juliusdavies.ca/logging.html


Any comments are very welcome!


-- 
yours,

Julius Davies
250-592-2284 (Home)
250-893-4579 (Mobile)
http://juliusdavies.ca/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to