Class EventLogger


  • public class EventLogger
    extends 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 Detail

      • EventLogger

        public EventLogger()
    • Method Detail

      • setMessage

        public EventLogger setMessage​(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​(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.