RE: Logging idioms or guidelines: anyone have some?

2002-08-28 Thread peter riegersperger

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

  So I'm interested in a best practices of logging, or a logging
  standard.
 
 Have a look at ISO-23544-5.
 

an iso-standard for logging? that made me curious. but the
iso-website claims to be unaware of a standard with that number.
where can i get some information about it?

thanks,

rick


|-
| peter riegersperger  [EMAIL PROTECTED]
|-
| subnet
| platform for media art and experimental technologies
|-
| http://www.subnet.at/
|-
| muehlbacherhofweg 5 // 5020 salzburg // austria
|-
| fon/fax +43/662/842 897
|-

-BEGIN PGP SIGNATURE-
Version: PGPfreeware 6.5.8 for non-commercial use http://www.pgp.com
Comment: public key available at http://home.subnet.at/rick/pgp/

iQA/AwUBPWzFaiDD9/SWDsvSEQKxcACeMtCnHxSoGv8PHKvHhJxEt8xMoGEAnRT+
2RyJcjZTnZdV8zAjpXNVkdA+
=1bay
-END PGP SIGNATURE-


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




Re: Logging idioms or guidelines: anyone have some?

2002-08-28 Thread Eric Jain

 an iso-standard for logging? that made me curious. but the
 iso-website claims to be unaware of a standard with that number.
 where can i get some information about it?

I was just joking, though there is in fact a standard, ISO/IEC-17799:2000.
This standard describes security measures and contains a section on logging
in this context. There is a summary at
http://www.systemexperts.com/tutors/17799.pdf.


--
Eric Jain



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




Logging idioms or guidelines: anyone have some?

2002-08-27 Thread MarkB

My boss is away, so I'm taking the opportuinity to clean up my code. I have
a set of standards I use for style, formatting, documentation, naming etc.
I also have a set of coding idioms I like to follow (Law of Demeter, code
metric limits, etc).

My problem is I don't yet have a set of logging idioms, and it shows up in
my sporradic logging style.
So I'm interested in a best practices of logging, or a logging
standard.

*Specifically* one that is based on something that makes it arguably
superior to other standards.

For example, do you log just before you do something:
  logger.debug(connecting to the database);
or after
   logger.debug(connected to the database);
or both?
Do you log when you throw an exception, catch one, or both?
etc...

Preachers of aspect oriented programming might not mind seeing a logging
statement at the entry and exit of every method. Some would certainly find
this to be overkill.

What do you all think?



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




Re: Logging idioms or guidelines: anyone have some?

2002-08-27 Thread Eric Jain

 So I'm interested in a best practices of logging, or a logging
 standard.

Have a look at ISO-23544-5.

Seriously, appart from being consistant I doubt there is any single best way
to do it.

You should of course keep in mind why exactely it is that you are logging,
as this influences the amount, distribution and form of log statements. Some
use cases are:

- Debug or monitor new or immature code
- Generate reports on usage patterns
- Trigger alerts on critical failures


 For example, do you log just before you do something:

Obviously it's a good idea to log before and after operations that take a
relatively long time or might hang or simply fail.

log.debug(Connecting to x)
try:
...
catch:
log.error(Couldn't connect to x, e)
throw e
log.info(Connected to x in  + t + ms)


I usually log errors when I catch them (and before I rethrow them, if),
since more often than not I am not the one who threw them in the first
place.


--
Eric Jain



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




RE: Logging idioms or guidelines: anyone have some?

2002-08-27 Thread Shapira, Yoav

Hi,
What you do, be consistent ;)  That'll make it easier to understand and
refactor later if necessary.  Other than that, it's a matter of style.
Sometimes it's a matter of personal style, sometimes organizational
guidelines.  There's an ISO standard somewhere about this, but I don't
remember off the top of my head.

For example, do you log just before you do something:
  logger.debug(connecting to the database);
or after
   logger.debug(connected to the database);
or both?

Both, if it's a significant operation.  Also for DEBUG-level statements,
I always use logger.isDebugEnabled() around them for performance.  It
makes a big difference on large systems.

Do you log when you throw an exception, catch one, or both?

Both, on the principal that exceptions are serious things and you want
to have caller (or thrower) as well as receiver (catcher) logging for
them.  There've been numerous times that I found having both logged
together gives me significant context information for the exception.

Preachers of aspect oriented programming might not mind seeing a
logging
statement at the entry and exit of every method. Some would certainly
find
this to be overkill.

Overkill.  But then again I'm very performance oriented.

Like I said, it's a matter of style.  The above are just IMHO.

Yoav Shapira
Millennium ChemInformatics


This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.



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