Logging verbosity

Lukas Krejci lkrejci at redhat.com
Tue Dec 17 18:00:55 UTC 2013


Recently, I noticed this as part of one commit:

                     LOG.warn("Availability collection failed with exception on " + resource
-                        + ", availability will be reported as " + DOWN.name(), t);
+                        + ", availability will be reported as " + DOWN.name() + ", reason=" + t.getMessage());

I am personally very much FOR having stacktraces in the log messages, especially in erroneous conditions like this one (i.e. IMHO almost any log message on WARN and ERROR levels SHOULD have a stacktrace attached). The reason is that including just the error message in the log loses information that would be very valuable during debugging potential bugs (even more so in a complex code like avail collection).

Is there a policy/consensus of sorts for inclusion/exclusion of full stacktraces in the log messages?

Cheers,

Lukas


More information about the rhq-devel mailing list