Class EventLogger


  • public class EventLogger
    extends java.lang.Object

    Provides an Event Logger service which will log [ INFO, WARN | ERROR | SECURITY ] events to the Transact event log database table.

    Event Log records are not encrypted and should not contain sensitive PII data.

    Examples

    Please find the event logger examples below.

    Create Info Event Log Record

    The example below creates a 'Info' Event Log record associated with the specified transaction record.

     import com.avoka.tm.svc.*
    
     new EventLogger()
          .setMessage("IDV-Status - application completed")
          .setTxn(txn)
          .logInfo()  

    Create Security Event Log Record

    The example below creates a 'Security' Event Log record associated with the specified transaction record. This example configures the EventLogger not to write the sensitive event log message to the server.log file.

     import com.avoka.tm.svc.*
    
     new EventLogger()
          .setMessage("Fraud Event with application : " + txn.formStatus + " : " + txn.formDataMap)
          .setRequest(request)
          .setTxn(txn)
          .setWriteToLogger(false)
          .logSecurity()  
    Since:
    5.0.0
    • Constructor Summary

      Constructors 
      Constructor Description
      EventLogger()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void logError()
      Log an Error event log record.
      void logInfo()
      Log an Information event log record.
      void logSecurity()
      Log an Security event log record.
      void logWarning()
      Log an Warning event log record.
      EventLogger setMessage​(java.lang.String message)
      Set the event log message property.
      EventLogger setRequest​(javax.servlet.http.HttpServletRequest request)
      Set the request property to log.
      EventLogger setTxn​(Txn txn)
      Set the transaction to associate with the event log.
      EventLogger setTxnId​(java.lang.Long txnId)
      Set the transaction record id to associate with the event log.
      EventLogger setWriteToLogger​(boolean writeToLogger)
      Specify whether to write a message to the Log4J server.log file.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • EventLogger

        public EventLogger()
    • Method Detail

      • setMessage

        public EventLogger setMessage​(java.lang.String message)
        Set the event log message property.
        Parameters:
        message - the message to log
        Returns:
        the event logger
      • setRequest

        public EventLogger setRequest​(javax.servlet.http.HttpServletRequest request)
        Set the request property to log.
        Parameters:
        request - the message to log
        Returns:
        the event logger
      • setTxn

        public EventLogger setTxn​(Txn txn)
        Set the transaction to associate with the event log.
        Parameters:
        txn - the transaction to associate with the event log
        Returns:
        the event logger
      • setTxnId

        public EventLogger setTxnId​(java.lang.Long txnId)
        Set the transaction record id to associate with the event log.
        Parameters:
        txnId - the transaction record id to associate with the event log
        Returns:
        the event logger
      • setWriteToLogger

        public EventLogger setWriteToLogger​(boolean writeToLogger)
        Specify whether to write a message to the Log4J server.log file.
        Parameters:
        writeToLogger - specify whether to write a message to the Log4J server.log file
        Returns:
        the event logger
      • logInfo

        public void logInfo()
        Log an Information event log record.
      • logWarning

        public void logWarning()
        Log an Warning event log record.
      • logError

        public void logError()
        Log an Error event log record.
      • logSecurity

        public void logSecurity()
        Log an Security event log record.