Package com.avoka.fc.core.service
Class ErrorLogService
- java.lang.Object
-
- com.avoka.fc.core.service.ErrorLogService
-
public class ErrorLogService extends Object
Provides an ErrorLog Service.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ErrorLogService.JsonLog
Provides an ErrorLog JSON message.
-
Constructor Summary
Constructors Constructor Description ErrorLogService()
Create an error log service with not error type defined.ErrorLogService(String errorType)
Create an error log service for the given error type.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description 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.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.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.ErrorLog
createJavaScriptErrorLog(String context, String stacktrace, HttpServletRequest request, Submission submission)
Create a Form JavaScript error log record to support the Open UX API.ErrorLog
logError(Class source, String userMsg, String context)
Log an error with the given class source, user message and context.ErrorLog
logError(Class source, String userMsg, String context, Throwable cause)
Log an error with the given class source, user message, context and cause.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.ErrorLog
logException(Throwable error)
Logs an Exception.ErrorLog
logException(Throwable error, boolean autoRollback)
Deprecated.autoRollback behaviour has been removed as of TM 4.1.ErrorLog
logException(Throwable error, EmailQueue emailQueue)
Logs an Exception.ErrorLog
logException(Throwable error, Submission submission)
Logs an Exception.ErrorLog
logException(Throwable error, HttpServletRequest request)
Logs an Exception.ErrorLog
logException(Throwable error, HttpServletRequest request, boolean autoRollback, Submission submission)
Deprecated.autoRollback behaviour has been removed as of TM 4.1.ErrorLog
logException(Throwable error, HttpServletRequest request, boolean autoRollback, Submission submission, EmailQueue emailQueue)
Deprecated.autoRollback behaviour has been removed as of TM 4.1.ErrorLog
logException(Throwable error, HttpServletRequest request, Submission submission, EmailQueue emailQueue)
Logs an Exception.ErrorLog
logExceptionNoRollback(Throwable error, EmailQueue emailQueue)
Deprecated.autoRollback behaviour has been removed as of TM 4.1, use logException(Throwable, EmailQueue) insteadErrorLog
logExceptionNoRollback(Throwable error, Submission submission)
Deprecated.autoRollback behaviour has been removed as of TM 4.1, use logException(Throwable, Submission) insteadErrorLog
logExceptionNoRollback(Throwable error, HttpServletRequest request)
Deprecated.autoRollback behaviour has been removed as of TM 4.1, use logException(Throwable, HttpServletRequest) insteadErrorLog
logGroovyException(Throwable error, HttpServletRequest request, Submission submission)
Logs an Groovy Script Exception.void
logJobActionError(Throwable error, JobAction jobAction, Submission submission)
Deprecated.void
logJobActionError(Throwable error, JobAction jobAction, Submission submission, boolean groovyError)
Log a JobAction exception to the error log.
-
-
-
Constructor Detail
-
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 Detail
-
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 erroruserMsg
- the end user display messagecontext
- 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 erroruserMsg
- the end user display messagecontext
- the contextcause
- 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 erroruserMsg
- the end user display messagecontext
- the contextcause
- the Throwable causing the errorsubmission
- 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 logsubmission
- 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 logemailQueue
- 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 logrequest
- 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 logrequest
- 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 logrequest
- the servlet request (optional)submission
- the associated submission with erroremailQueue
- 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 GroovyJobActionsubmission
- 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 witherror
- the error to loguserName
- the logged in userNamerequest
- the http requestsubmission
- 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 witherror
- the error to loguserName
- the logged in userNamerequest
- the http requestsubmission
- the associated submission with erroremailQueue
- the email queue to sendjobAction
- 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 witherror
- the error to loguserName
- the logged in userNamerequest
- the http requestsubmission
- the associated submission with erroremailQueue
- the email queue to sendjobAction
- the job actiongroovyError
- the error is a groovy errormessage
- 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 errorstacktrace
- the JavaScript stacktracerequest
- 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 logautoRollback
- 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 logrequest
- http requestautoRollback
- 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 logrequest
- 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 erroremailQueue
- 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) insteadLog an exception. DO NOT USE. This method may be removed in the future.- Parameters:
error
- the error to logsubmission
- 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) insteadLog an exception. DO NOT USE. This method may be removed in the future.- Parameters:
error
- the error to logemailQueue
- 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) insteadCreate 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 logrequest
- the servlet request (optional)- Returns:
- the created error log record
- Since:
- 4.0.0
-
-