Class AbstractJDBCTarget

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.sql.Connection m_connection  
      private javax.sql.DataSource m_dataSource  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AbstractJDBCTarget​(javax.sql.DataSource dataSource)
      Creation of a new instance of the AbstractJDBCTarget.
    • Field Detail

      • m_dataSource

        private javax.sql.DataSource m_dataSource
      • m_connection

        private java.sql.Connection m_connection
    • Constructor Detail

      • AbstractJDBCTarget

        protected AbstractJDBCTarget​(javax.sql.DataSource dataSource)
        Creation of a new instance of the AbstractJDBCTarget.
        Parameters:
        dataSource - the JDBC datasource
    • Method Detail

      • doProcessEvent

        protected void doProcessEvent​(LogEvent event)
                               throws java.lang.Exception
        Process a log event, via formatting and outputting it.
        Specified by:
        doProcessEvent in class AbstractTarget
        Parameters:
        event - the log event
        Throws:
        java.lang.Exception - if an event processing error occurs
      • output

        protected abstract void output​(LogEvent event)
        Output a log event to DB. This must be implemented by subclasses.
        Parameters:
        event - the log event.
      • open

        protected void open()
        Startup log session.
        Overrides:
        open in class AbstractTarget
      • openConnection

        protected void openConnection()
        Open connection to underlying database.
      • getConnection

        protected final java.sql.Connection getConnection()
        Utility method for subclasses to access connection.
        Returns:
        the Connection
      • checkConnection

        protected final void checkConnection()
        Utility method to check connection and bring it back up if necessary.
      • isStale

        protected boolean isStale()
        Detect if connection is stale and should be reopened.
        Returns:
        true if connection is stale, false otherwise
      • close

        public void close()
        Shutdown target. Attempting to write to target after close() will cause errors to be logged.
        Specified by:
        close in interface Closeable
        Overrides:
        close in class AbstractTarget
      • closeConnection

        protected void closeConnection()
        Close connection to underlying database.