Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 11 Next »

Data model

The error_logging_exception_log table lists summary information and metadata about the overall exception:

error_logging_exception_log (
  exception_log_id,   -- Primary key of the table
  exception_class,    -- The specific type of exception that was thrown
  exception_message,  -- The exception message
  openmrs_version,    -- Version of OpenMRS
  exception_datetime, -- Timestamp for the exception
  user_id             -- References user to store which user experienced the error
)

The error_logging_exception_log_detail table lists the specific stack trace information that is relevant:

error_logging_exception_log_detail (
  exception_log_detail_id,  -- Primary key of the table
  exception_log_id,         -- References the error_logging_exception_log table above
  file_name,                -- The filename extracted from the stack trace
  class_name,               -- The class name extracted from the stack trace
  method_name,              -- The method name extracted from the stack trace
  line_number               -- The line number extracted from the stack trace
)

The exception_root_cause table is used to store details about the root cause if it exists, this is important for situations where the original thrown exception is wrapped into another exception type and the actual root cause gets masked in the process, therefore it is important to capture these details too.

error_logging_exception_root_cause (
  exception_root_cause_id,    -- Primary key of the table
  exception_log_id,           -- Foreign Key to the actual exception that was thrown
  exception_class,            -- The specific type of exception that was thrown
  message,                    -- The exception message
)

The error_logging_exception_root_cause_detail table hold extra information about the root cause

error_logging_exception_root_cause _detail (
  exception_root_cause _detail_id,  -- Primary key of the table
  exception_root_cause_id,          -- References the error_logging_exception_root_cause table above
  file_name,                        -- The filename extracted from the stack trace
  class_name,                       -- The class name extracted from the stack trace
  method_name,                      -- The method name extracted from the stack trace
  line_number                       -- The line number extracted from the stack trace
)

Error handling

In the OpenMRS core there are 2 pages where uncaught exceptions are handled, which are uncaughtException.jsp and errorHandler.jsp. When uncaught exception occurred one of those pages is displayed and Error Logging Module is notified by about it via extension points in those pages. To get exception and detail information about it is used an attribute of the request "javax.servlet.error.exception".

Error handling at the application level

Exceptions thrown by code going threw Servlets and Controllers are handled by uncaughtException.jsp because of the web.xml entry. 

web.xml
...
<error-page>
        <exception-type>java.lang.Exception</exception-type>
        <location>/uncaughtException</location>
</error-page>

<servlet-mapping>
        <servlet-name>openmrs</servlet-name>
        <url-pattern>/uncaughtException</url-pattern>
</servlet-mapping>
...

To get those types of exceptions is used extension point in the uncaughtException.jsp. 

uncaughtException.jsp
...
<openmrs:extensionPoint pointId="org.openmrs.uncaughtException" type="html" />
...

Error handling at the page level

Exceptions  thrown from the .tag files and jsps including embedded scriptlets are handled by errorHandler.jsp which is defined as the default error page via a jsp directive.

errorHandler.jsp
<%@ page isErrorPage="true" import="java.io.*" %>
...
header.jsp
<%@ page errorPage="/errorhandler.jsp" %>
...

To get those types of exceptions is used extension point in the errorHandler.jsp. 

errorHandler.jsp
...
<openmrs:extensionPoint pointId="org.openmrs.errorHandler" type="html" />
...

Ignored exceptions

To allow admin to set which errors to ignore to prevent large numbers of errors getting into table in the Error Logging Module is used manage page:

Ignored exceptions are saved in the global properties:

config.xml
...
    <globalProperty>
        <property>${project.parent.artifactId}.ignore.errors</property>
        <defaultValue></defaultValue>
        <description>Allows admin to set which errors to ignore to prevent large numbers of errors getting into table</description>
    </globalProperty>
...

Authentication related exceptions are ignored in the module by default.

ErrorLoggingConstants.java
...
public static final String[] ERRROR_LOGGING_DEDAULT_IGNORED_EXCEPTION = new String[] {
	        "org.openmrs.api.APIAuthenticationException", "org.openmrs.api.context.ContextAuthenticationException" };
...
  • No labels