SwallowedExceptionLogger (Apache Tomcat 9.0.111 API Documentation)
Description: declaration: package: org.apache.tomcat.dbcp.dbcp2, class: SwallowedExceptionLogger

# Class SwallowedExceptionLogger

java.lang.Object
org.apache.tomcat.dbcp.dbcp2.SwallowedExceptionLogger

All Implemented Interfaces:
  `SwallowedExceptionListener`

public class SwallowedExceptionLogger extends Object implements SwallowedExceptionListener
Class for logging swallowed exceptions.

Since:
  2.0

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SwallowedExceptionLogger(Log log)`
  Create a SwallowedExceptionLogger with the given logger.
  `SwallowedExceptionLogger(Log log, boolean logExpiredConnections)`
  Create a SwallowedExceptionLogger with the given logger and expired connection logging property.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `onSwallowException(Exception e)`
  Notifies this instance every time the implementation unavoidably swallows an exception.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### SwallowedExceptionLogger

    public SwallowedExceptionLogger(Log log)
    Create a SwallowedExceptionLogger with the given logger. By default, expired connection logging is turned on.
    Parameters:
      `log` - logger

  - ### SwallowedExceptionLogger

    public SwallowedExceptionLogger(Log log, boolean logExpiredConnections)
    Create a SwallowedExceptionLogger with the given logger and expired connection logging property.
    Parameters:
      `log` - logger
      `logExpiredConnections` - false suppresses logging of expired connection events

- ## Method Details

  - ### onSwallowException

    public void onSwallowException(Exception e)
    Description copied from interface: `SwallowedExceptionListener`
    Notifies this instance every time the implementation unavoidably swallows an exception.
    Specified by:
      `onSwallowException` in interface `SwallowedExceptionListener`
    Parameters:
      `e` - The exception that was swallowed