Details
-
Bug
-
Resolution: Fixed
-
Major
-
0.9.18
-
None
Description
DbAppender uses a single table logging_event_exception to persist stack traces, inserting one row per each stack frame. Also, each row has its parent event id. Unfortunately this approach loses a lot of exception details, making it unable to fully recreate ILoggingEvent instance that was logged by the DbAppender. List of attributes that are missing:
- exception message
- exception class name
- exception root cause
Also logging_event_exception saves the result of ch.qos.logback.classic.spi.StackTraceElementProxy#toString (which refers to java.lang.StackTraceElement#toString) instead of saving each element of java.lang.StackTraceElement separately. Now, in order to recreate StackTraceElement instance one must parse (probably using regular expression) string saved in trace_line attribute.
My suggestion would be to create two tables:
- logging_event_throwable with columns: message, class_name and cause foreign key referencing other logging_event_throwable instance
- logging_event_stack_frame with columns: class_name, method, file, line and a foreign key referencing logging_event_throwable + indexing column
Also logging_event would have a optional foreign key to logging_event_throwable.
This modifications in database schema would allow to fully recreate ILoggingEvent. For backward compatibility ch.qos.logback.classic.db.DBAppender should remain untouched. The idea is to subclass it and override ch.qos.logback.classic.db.DBAppender#insertThrowable.