0

我正在尝试将 logback-classic 库从版本 1.2.3 升级到 1.2.8。补丁说明说所有 DB 相关代码都已被删除,因此新版本https://logback.qos.ch/news.html中不再存在主要的 DBAppender 类。有没有人找到某种升级指南或知道解决方法?

4

1 回答 1

0

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'
于 2022-02-03T18:46:25.113 回答