
That works as you describe, with the format logger.debug(formatString, Object[]) where my formatString has placeholders for 6 parameters and there are 7 parameters in the Object[], where index 6 (the last one) has the exception as its object.. Thanks for the quick response Merritt From: Ceki Gulcu <ceki@qos.ch> To: logback-user@qos.ch Date: 01/07/2011 12:50 PM Subject: Re: [logback-user] logger option with string format, argument array and throwable Sent by: logback-user-bounces@qos.ch Hello Merritt, I think this issue was fixed in SLF4J 1.6.0. The release notes state: In the presence of multiple parameters and if the last argument in a logging statement is an exception, then SLF4J will now presume that the user wants the last argument to be treated as an exception and not a simple parameter. See the relevant FAQ entry for further details. This fixes bug 70 submitted by Joern Huxhorn who also provided the relevant patch. So in principle you should be able to write logger.debug("bad name {}", name, illegalArgumentException); and logback should handle name as an argument and illegalArgumentException as an exception. If that does not work, it's a bug which should be reported as a jira issue. Cheers, On 07.01.2011 17:36, Merritt H Derr wrote:
This is for Logback 0.9.27.
When logging using DBAppender, The argument fields in the database table logging_event are filled using the arguments from the log statement when used in for example the debug(String format, Object[] arguments) format.
For the case where I want to log with a throwable included that would land in the logging_event_exception table, there is no debug method that will take a format, argument array and throwable, so I can't log using a format and argument array and hence, all the argument fields (Arg0, Arg1, Arg2, Arg3) are left blank in the logging_event table.
Other than storing those arguments in the MDC for this case, is there another work around? Or am I just missing something simple?
Thanks,
Merritt Derr
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user Join us on Facebook at www.facebook.com/NYCMInsurance. ***CONFIDENTIALITY NOTICE*** This email and any attachments to it are confidential and intended solely for the individual or entity to whom it is addressed. Any unauthorized review, use, disclosure or distribution is prohibited. If you have received this email in error, please contact the sender by reply email and destroy all copies of the original message.