[Hawkular-dev] Reasons not to use org.jboss.logging.annotations.Cause at all?
John Mazzitelli
mazz at redhat.com
Thu Jun 4 08:51:07 EDT 2015
The discussions we had a few months ago around using these logging annotations was that anything that is logged at INFO, WARN or ERROR level will be via this jboss logging annotation mechanism. TRACE or DEBUG we can just use logger debugf and tracef directly without putting the messages in those logger classes with the annotations.
Of course, usually when you have a Throwable, you are logging at least at the WARN level, so yeah, use these annotations for that kind of thing (as a general rule).
----- Original Message -----
> 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