'Logback-classic 1.2.8 DBAppender Missing

I'm trying to upgrade the logback-classic library from version 1.2.3 to 1.2.8. The patch notes say that all DB related code has been removed, so the main DBAppender class no longer exists in the new version https://logback.qos.ch/news.html. Has anyone found some kind of upgrade guide or know of a workaround solution?



Solution 1:[1]

I was wondering the same thing after upgrading spring to the 2.6.3 which pulls in logback version 1.2.8+ through spring-boot-starter-logging dependency.

According to logback's site: https://logback.qos.ch/news.html in version 1.2.8: "2) we have removed all database (JDBC) related code in the project with no replacement."

My logback xml configuration file has a custom DB Appender in it and the application failed to build with the following error: Could not create an Appender of type [ch.qos.logback.classic.db.DBAppender]. ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.classic.db.DBAppender

After doing some research, I found a ticket in the logback backlog with a request to document how to proceed. https://jira.qos.ch/browse/LOGBACK-1609

Apparently the DB appender was removed due to a vulnerability.

According to the developer: "The source code is still there. Until this issue is resolved, you can fetch the code from tag 1.2.8 and rebuild. The DBAppender issue is a bit more complex than what people think. As you can imagine, we have a lot on my plate these days but we'll get to it eventually."

So it sounds like the code was removed while they work on a fix and support will be added back eventually. I wouldn't count on a quick fix though.

As a workaround I have pinned the logback version in my projects gradle file so that I can use the latest version of spring along with the latest version of logback that still supports the DB appender class.

Here is the syntax I used:

ext['logback.version'] = '1.2.7'

Solution 2:[2]

Please see https://logback.qos.ch/news.html.

2022-04-20, Release of logback.db version 1.2.11.1

As of logback version 1.2.8 DBAppender no longer ships with logback. However, DBAppender for logback-classic is available under the following Maven coordinates:

ch.qos.logback.db:logback-classic-db:1.2.11.1

and for logback-access under

ch.qos.logback.db:logback-access-db:1.2.11.1

Both of these artifacts require ch.qos.logback.db:logback-core-db:1.2.11.1 which will be pulled in automatically by Maven's transitivity rules.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Tony Edwards