Solve the conflict between log4j (and slf4j-log4j12) and logback under tomcat

If you encounter a strange problem, record the solution process. Problem description:

1. Phenomenon. The startup process prompts that there are two packages related to the same class Log, and the later LogbackConfigListener reports a class conversion error. Project startup failed.

2, the solution process. So find all references to Log4j, slf4j-log4j12, exclude. It's written everywhere, and the maven dependency tree doesn't show these two dependencies anymore. But ah, there are always these two packages in the lib. It is useless to delete them manually, and the reimport comes in again and crashes. The debugger found that there was a deep dependency that referenced Log4j (why the dependency tree card disappeared???!!!), so log4j-over-slf4j was introduced instead of log4j, which was solved. However, the two jars of log4j and slf4j-log4j cannot be removed, they can only be imported directly, and then the scope is set to provided. So far, the problem is all solved. The two conflicting jars are left with it, why can't they be deleted, and I still haven't figured it out.

There must be a reference somewhere, why the dependency tree is not displayed. . . When you have time, open the jars one by one and see.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327054204&siteId=291194637