0

How do I log an exception?

Share:

In this example you can see how we can log an exception when it occures. In
the code below we are trying to parse an invalid date which will give us a
ParseException. To log the exception we call the Logger.log()
method, passes the logger Level, add some user friendly message and
the Throwable object.

The code above will produce the following log message.

Filed in: Java Logging
© 6307 Java Examples - Built with love by Wayan Saryada.