Class ErrorLogService

java.lang.Object
com.avoka.fc.core.service.ErrorLogService

public class ErrorLogService extends Object
Provides an ErrorLog Service.
  • Constructor Details

    • ErrorLogService

      public ErrorLogService()
      Create an error log service with not error type defined.
      Since:
      4.3.4
    • ErrorLogService

      public ErrorLogService(String errorType)
      Create an error log service for the given error type.
      Parameters:
      errorType - the error type.
      Since:
      4.3.4
  • Method Details

    • logError

      public ErrorLog logError(Class source, String userMsg, String context)
      Log an error with the given class source, user message and context. This method will not rollback any transactions.
      Parameters:
      source - the source class of the error
      userMsg - the end user display message
      context - the context
      Returns:
      a new ErrorLog record
    • logError

      public ErrorLog logError(Class source, String userMsg, String context, Throwable cause)
      Log an error with the given class source, user message, context and cause. This method will not rollback any transactions.
      Parameters:
      source - the source class of the error
      userMsg - the end user display message
      context - the context
      cause - the Throwable causing the error
      Returns:
      a new ErrorLog record
      Since:
      4.1.0
    • logError

      public ErrorLog logError(Class source, String userMsg, String context, Throwable cause, Submission submission)
      Log an error with the given class source, user message, context and cause. The error will be associated with the given submission. This method will not rollback any transactions.
      Parameters:
      source - the source class of the error
      userMsg - the end user display message
      context - the context
      cause - the Throwable causing the error
      submission - the submission associated with the error
      Returns:
      a new ErrorLog record
      Since:
      4.1.0
    • logException

      public ErrorLog logException(Throwable error)
      Logs an Exception.
      Parameters:
      error - the error to log
      Returns:
      the created error log record
    • logException

      public ErrorLog logException(Throwable error, Submission submission)
      Logs an Exception.
      Parameters:
      error - the error to log
      submission - the associated submission with error
      Returns:
      the created error log record
    • logException

      public ErrorLog logException(Throwable error, EmailQueue emailQueue)
      Logs an Exception.
      Parameters:
      error - the error to log
      emailQueue - the associated email queue item
      Returns:
      the created error log record
    • logException

      public ErrorLog logException(Throwable error, HttpServletRequest request)
      Logs an Exception.
      Parameters:
      error - the error to log
      request - the servlet request (optional)
      Returns:
      the created error log record
    • logGroovyException

      public ErrorLog logGroovyException(Throwable error, HttpServletRequest request, Submission submission)
      Logs an Groovy Script Exception. Note that this method creates its own DataContext to commit the error log entity.
      Parameters:
      error - the error to log
      request - the servlet request (optional)
      submission - the associated submission with error (optinal)
      Returns:
      the created error log record
      Since:
      4.3.4
    • logException

      public ErrorLog logException(Throwable error, HttpServletRequest request, Submission submission, EmailQueue emailQueue)
      Logs an Exception. Note that this method creates its own DataContext to commit the error log entity.
      Parameters:
      error - the error to log
      request - the servlet request (optional)
      submission - the associated submission with error
      emailQueue - the email queue to send
      Returns:
      the created error log record
      Since:
      4.1.0
    • logJobActionError

      @Deprecated public void logJobActionError(Throwable error, JobAction jobAction, Submission submission)
      Deprecated.
      Log a JobAction exception to the error log.
      Parameters:
      error - the error to log (required)
      jobAction - the associated job action (optional)
      submission - the associated submission
      Since:
      4.1.0
    • logJobActionError

      public void logJobActionError(Throwable error, JobAction jobAction, Submission submission, boolean groovyError)
      Log a JobAction exception to the error log.
      Parameters:
      error - the error to log (required)
      jobAction - the associated job action (optional)
      groovyError - the error is associated with a GroovyJobAction
      submission - the associated submission
      Since:
      4.3.4
    • createErrorLog

      public ErrorLog createErrorLog(org.apache.cayenne.access.DataContext dataContext, Throwable error, String userName, HttpServletRequest request, Submission submission)
      Create an error log entry for the given exception.
      Parameters:
      dataContext - the dataContext to create the error log with
      error - the error to log
      userName - the logged in userName
      request - the http request
      submission - the associated submission with error
      Returns:
      a new ErrorLog
    • createErrorLog

      public ErrorLog createErrorLog(org.apache.cayenne.access.DataContext dataContext, Throwable error, String userName, HttpServletRequest request, Submission submission, EmailQueue emailQueue, JobAction jobAction)
      Create an error log entry for the given exception, logged in userName and requestUrl.

      Note you should specify a new DataContext for this method, as the previous thread local data context may be in an error state.

      Parameters:
      dataContext - the dataContext to create the error log with
      error - the error to log
      userName - the logged in userName
      request - the http request
      submission - the associated submission with error
      emailQueue - the email queue to send
      jobAction - the job action
      Returns:
      a new ErrorLog
    • createErrorLog

      public ErrorLog createErrorLog(org.apache.cayenne.access.DataContext dataContext, Throwable error, String userName, HttpServletRequest request, Submission submission, EmailQueue emailQueue, JobAction jobAction, boolean groovyError, String message)
      Create an error log entry for the given exception, logged in userName and requestUrl.

      Note you should specify a new DataContext for this method, as the previous thread local data context may be in an error state.

      Parameters:
      dataContext - the dataContext to create the error log with
      error - the error to log
      userName - the logged in userName
      request - the http request
      submission - the associated submission with error
      emailQueue - the email queue to send
      jobAction - the job action
      groovyError - the error is a groovy error
      message - the error log message
      Returns:
      a new ErrorLog
      Since:
      17.1.0
    • createJavaScriptErrorLog

      public ErrorLog createJavaScriptErrorLog(String context, String stacktrace, HttpServletRequest request, Submission submission)
      Create a Form JavaScript error log record to support the Open UX API.
      Parameters:
      context - the Form context of the error
      stacktrace - the JavaScript stacktrace
      request - the HTTP request (required)
      submission - the submission record (required)
      Returns:
      a new ErrorLog
      Since:
      18.5.0
    • logException

      @Deprecated public ErrorLog logException(Throwable error, boolean autoRollback)
      Deprecated.
      autoRollback behaviour has been removed as of TM 4.1. Use logException(Throwable) instead.
      Logs an Exception. DO NOT USE. This method may be removed in the future.
      Parameters:
      error - the error to log
      autoRollback - the thread data context should be rolled back (NOTE: as of TM 4.1, this parameter is being ignored)
      Returns:
      the created error log record
    • logException

      @Deprecated public ErrorLog logException(Throwable error, HttpServletRequest request, boolean autoRollback, Submission submission)
      Deprecated.
      autoRollback behaviour has been removed as of TM 4.1. Use logException(Throwable, HttpServletRequst, Submission, EmailQueue) instead.
      Logs an Exception. DO NOT USE. This method may be removed in the future.
      Parameters:
      error - the error to log
      request - http request
      autoRollback - whether to roll back first (NOTE: as of TM 4.1, this parameter is being ignored)
      submission - the associated submission with error
      Returns:
      the created error log record
    • logException

      @Deprecated public ErrorLog logException(Throwable error, HttpServletRequest request, boolean autoRollback, Submission submission, EmailQueue emailQueue)
      Deprecated.
      autoRollback behaviour has been removed as of TM 4.1. Use logException(Throwable, HttpServletRequst, Submission, EmailQueue) instead.
      Logs an Exception. DO NOT USE. This method may be removed in the future. Note that this method contains database transactions.
      Parameters:
      error - the error to log
      request - the servlet request (optional)
      autoRollback - the thread data context should be rolled back (NOTE: as of TM 4.1, this parameter is being ignored)
      submission - the associated submission with error
      emailQueue - the email queue to send
      Returns:
      the created error log record
    • logExceptionNoRollback

      @Deprecated public ErrorLog logExceptionNoRollback(Throwable error, Submission submission)
      Deprecated.
      autoRollback behaviour has been removed as of TM 4.1, use logException(Throwable, Submission) instead
      Log an exception. DO NOT USE. This method may be removed in the future.
      Parameters:
      error - the error to log
      submission - the associated submission with error
      Returns:
      the created error log record
    • logExceptionNoRollback

      @Deprecated public ErrorLog logExceptionNoRollback(Throwable error, EmailQueue emailQueue)
      Deprecated.
      autoRollback behaviour has been removed as of TM 4.1, use logException(Throwable, EmailQueue) instead
      Log an exception. DO NOT USE. This method may be removed in the future.
      Parameters:
      error - the error to log
      emailQueue - email queue
      Returns:
      the created error log record
    • logExceptionNoRollback

      @Deprecated public ErrorLog logExceptionNoRollback(Throwable error, HttpServletRequest request)
      Deprecated.
      autoRollback behaviour has been removed as of TM 4.1, use logException(Throwable, HttpServletRequest) instead
      Create an ErrorLog record from the given error and request. DO NOT USE. This method may be removed in the future.
      Parameters:
      error - the error to log
      request - the servlet request (optional)
      Returns:
      the created error log record
      Since:
      4.0.0