-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Enhancement] Log printing failure problem in agent mode #1513
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## develop #1513 +/- ##
=============================================
- Coverage 34.23% 30.66% -3.58%
Complexity 847 847
=============================================
Files 262 298 +36
Lines 5953 6647 +694
Branches 560 646 +86
=============================================
Hits 2038 2038
- Misses 3722 4416 +694
Partials 193 193
☔ View full report in Codecov by Sentry. |
Fixes #1428
At present, java prints logs mostly with slf4j and log4j/logback, but agent is a separate jar package.
To use slf4j, you need to introduce the package into agent, which may conflict with the business's own slf4j logback log.
And after the agent package uses the slf4j-api package, you need to ensure that the classLoader of the agent is consistent with the classLoader of the business, otherwise conflicts cannot be found or repeated.
How to remove conflict
In tomcat
The internal logging for Apache Tomcat uses JULI, a packaged renamed fork of Apache Commons Logging that is hard-coded to use the java.util.logging framework. This ensures that Tomcat's internal logging and any web application logging will remain independent, even if a web application uses Apache Commons Logging.
Reference: https://tomcat.apache.org/tomcat-9.0-doc/logging.html
In pinpoint and skywalking
Pinoint and skywalking create custom Logger class. They use sender class to transfer trace and metric to collector server.
Reference:
Solution
There is a Skywalking-like ILOG component in the agent-core package, which removes the ILog component from the existing agent-core package into the infra common package, so that other Agent modules can directly use the custom log component without relying on Slf4j to print the log, avoiding the problem of log non-printing.
Successfully solved: