[logback-user] Newbie--Exceptions to log file

Chris Pratt thechrispratt at gmail.com
Wed May 30 18:25:54 CEST 2012


Instead of using ex.printStackTrace(), use the SLF4j Logger method that
takes a Throwable.  i.e. change:

ex.printStackTrace();

to:

log.warn("Bad things afoot",ex);

  (*Chris*)

On Wed, May 30, 2012 at 9:19 AM, <Greg.Zoller at aviall.com> wrote:

> Hello,
>
> Is there a way to configure logback to rouge Java exceptions to the log
> file?  I've got all my other messages going to my desired file successfully
> but exceptions still go to the console.
>
> Thanks!
> Greg
>
> "If I had asked my customers what they wanted, they would have said 'A
> faster horse'" -- Henry Ford
>
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>
> This e-mail message, including attachments, may contain confidential,
> proprietary, or export controlled information.
> Any unauthorized disclosure, distribution, or other use is prohibited,
> unless expressly authorized.
> If you receive this e-mail in error, please notify the sender, and delete
> all copies of the original message from your systems.
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/logback-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20120530/4291dcef/attachment.html>


More information about the Logback-user mailing list