Alan D. Cabrera a écrit :
Just one more thing that I noted in the class, there are no log
statements. Dom't we need them?
I'm against logging exceptions if we're re-throwing them unless we
print out some critical piece of information that cannot be discerned
by any other method. I say this from experience where I had to slog
through millions of log statements generated by one exception where
every well meaning layer printed something out.
IMO, we should log :
- where we got the exception if we now that no log has already been
generated
- if and only if the log adds some value to what has already be loaded
- In some case, it might be interesting to use a specific logger. For
instance, if you grab a new connection to a LDAP serve,r and get an
exception, using a dedicated logger can help when analysing specifically
all the LDAP related issues.
Logging too much is deadly... Not logging enough is deadly too. Use
common sense, test you code, and check if you are just logging enough
and not too much.