-
Notifications
You must be signed in to change notification settings - Fork 188
Description
What happened?
logger problems occurs when use slf4j for logging in Sermant
1、slf4j 1.7.x and below use classloader to find binds of StaticLoggerBinder
2、slf4j 1.8.x and above use SPI to find SLF4JServiceProvider
both FrameworkClassLoader and PluginClassLoader should be fixed, we use PluginClassLoader to illustrate the problem
case1(Plugin use slf4j 1.7.x-): getResources will find StaticLoggerBinder bindings both in the plugin and in the host application, and the order is undefined due to the slf4j doc, so may cause plugin can not log correctly
case2(Plugin use slf4j 1.8.x+): getResources will find SLF4JServiceProvider implementations both in the plugin and in the host application, this will cause load of related classes in host application, and may cause problems
(due to privacy issue we can not post related info, but the problem is as descirbed)
How can we reproduce it (as minimally and precisely as possible)?
This problem is already known to Sermant, and in 2.X is almost fixed. (getResources)
https://github.com/sermant-io/Sermant/blob/2.2.x/sermant-agentcore/sermant-agentcore-core/src/main/java/io/sermant/core/classloader/FrameworkClassLoader.java
We expect:
Seramnt 1.x: Both FrameworkClassLoader and PluginClassLoader should be fixed as above
Sermant 2.x: PluginClassLoader missed process of StaticLoggerBinder, and should be fixed
Anything else we need to know?
We already upload the patch code to the enviroment, and found the solution works.
Sermant version
Details
Sermant 1.2.0-1.4.1OS version
Details
# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here
# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here