[Hawkular-dev] Reasons not to use org.jboss.logging.annotations.Cause at all?

Lukas Krejci lkrejci at redhat.com
Fri Jun 5 08:25:00 EDT 2015


I think the reason for NOT exposing causes is that end users are usually not interested in
them.

On the other hand they can provide additional diagnostic information so devs are interested
;)

The default formatters in wfly have the %E parameter which will include the stacktrace in 
the log message if you provide one but at least for me, having the log filled with 
stacktraces just defeats the purpose of a log, because it becomes nearly unintelligible.

Of course, you can reconfigure your loggers and handlers to use different formatters at
different occasions so "log mess" is not an argument against using @Cause's in your
log messages but IMHO the defaults in Wfly are at least problematic because they expose
the mess.

Btw. your email got me completely on a tangent yesterday and I ended up with 
https://github.com/jboss-logging/jboss-logging-tools/pull/31 which I fear is going to get
rejected but I still think it is at least partially a good idea ;)

Lukas


----- Original Message -----
> From: "Peter Palaga" <ppalaga at redhat.com>
> To: "Discussions around Hawkular development" <hawkular-dev at lists.jboss.org>
> Sent: Thursday, 4 June, 2015 11:49:34 AM
> Subject: [Hawkular-dev] Reasons not to use	org.jboss.logging.annotations.Cause at all?
> 
> Hi *,
> 
> I am just improving the log output in Pinger and Availability Creator
> [1] and I found out that one can define a LogMessage containing all the
> details of a thrown exception (incl error message and stack trace) like
> this:
> 
>      @LogMessage(level = Logger.Level.ERROR)
>      @Message(id = 5007, value = "Could not send a message to the bus")
>      void eCouldNotSendMessage(@Cause Throwable e);
> 
> Indeed, messages like this can be seen in Bus, Agent and Inventory, but
> nowhere else.
> 
> Are there some reasons for *not* using this @Cause message style at all?
> 
> It is clear that not every thrown exception needs to clutter the log
> with its stack trace. But generally, things that are supposed to work in
> all cases and situations (like sending messages to bus) should be logged
> incl. stack traces, should they not?
> 
> Thanks,
> 
> Peter
> 
> [1] https://issues.jboss.org/browse/HAWKULAR-309
> _______________________________________________
> hawkular-dev mailing list
> hawkular-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hawkular-dev
> 


More information about the hawkular-dev mailing list