I have configured SLF4J using logback DbAppender and it writes logs to database as expected, but some Error messages are not written to the database. Those messages are written only to file log.
I suspect that message lenght or some characters cannot be written to database, but I need a clue, what is wrong with some specific error messages.
How can I troubleshoot error in DbAppender logging ? Is there any chance to switch on DbAppender logging (in other words to catch/read DbAppender implementation logs itself) to figure out if any exception happens during writting specific messages to db log ?
In order to log issues related to "logging". You need to have debug="true"
in logback.config .
For example
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="30 seconds" debug="true">
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SS} %-5level [%t][%X] %logger %msg %ex%n</pattern>
</encoder>
</appender>
<root level="TRACE">
<appender-ref ref="CONSOLE"/>
</root>
</configuration>
Having debug="true"
enables to identify issue related to DbAppender. In my case it was caused by dropped sequence and I could see in the log:
17:26:40,060 |-ERROR in ch.qos.logback.classic.db.DBAppender[DbAppender] - problem appending event java.sql.SQLSyntaxErrorException: ORA-04098: trigger 'OCS_O2.LOGGING_EVENT_ID_SEQ_TRIG' .......
at java.sql.SQLSyntaxErrorException: ORA-04098: trigger 'OCS_O2.LOGGING_EVENT_ID_SEQ_TRIG' ......