So, here it is:
In log4j, you maybe used to writing:
logger.warn("Exception caught: ", e);
This is perfectly valid and works fine. If you use this line in akka logging, you will get the error "WARNING arguments left: 1" because in the case of logback, the syntax assumes it is filling in params from the string, so it expects this:
logger.warning("Exception caught: {}", e);
Hope this will help all of us (including me) not to get caught by this again....
Thanks:)
ReplyDelete+1
ReplyDeletelogger.error(e,"Exception caught");
ReplyDelete+1
ReplyDelete+1
ReplyDeleteThanks, this helped.
ReplyDeleteThank you, it is quite helpful
ReplyDeleteAgree with Unknown above, in most cases I think logger.error(e, "Problem doing X") is a better approach because your logging system can deal with the Exception directly, instead of just getting a toString version of the Exception (usually the message field). With an out of the box configuration this means you'll actually get the stack trace in the logs.
ReplyDeleteconcise and very to the point. thanks.
ReplyDeletewhat?
ReplyDeletei can't understand