feat(log): bridge JUL to SLF4J and improve shutdown log reliability#122
feat(log): bridge JUL to SLF4J and improve shutdown log reliability#122halibobo1205 wants to merge 8 commits intodevelopfrom
Conversation
|
CodeAnt AI is reviewing your PR. Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
CodeAnt AI finished reviewing your PR. |
|
@CodeAnt-AI: review |
|
CodeAnt AI is running the review. Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
Sequence DiagramThis PR routes Java runtime and gRPC JUL logs into the standard SLF4J/Logback pipeline and extends the log shutdown hook to wait longer and flush the async queue, reducing lost logs during shutdown. sequenceDiagram
participant Node
participant JulLogger
participant Slf4jBridge
participant LoggingSystem
participant LogFile
participant ShutdownHook
Node->>JulLogger: Emit runtime diagnostic log
JulLogger->>Slf4jBridge: Forward JUL log record
Slf4jBridge->>LoggingSystem: Route as SLF4J event
LoggingSystem->>LogFile: Append to application log
Node->>ShutdownHook: JVM shutdown starts
ShutdownHook->>Node: Wait for graceful shutdown up to 120 s
ShutdownHook->>LoggingSystem: Stop logging and flush queue up to 5 s
LoggingSystem->>LogFile: Persist remaining log events
Generated by CodeAnt AI |
|
CodeAnt AI finished running the review. Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
|
CodeAnt AI is running Incremental review Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
|
CodeAnt AI Incremental review completed. |
|
@CodeAnt-AI: review |
|
CodeAnt AI is running the review. Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
Sequence DiagramThis PR routes gRPC Java util logging into the existing SLF4J Logback pipeline and extends the shutdown hook to wait longer and flush the async log queue, reducing lost logs during runtime and shutdown. sequenceDiagram
participant Node
participant CommonParameter
participant gRPC
participant LoggingBridge
participant Logback
participant LogFile
participant ShutdownHook
Node->>CommonParameter: Load configuration (static initializer)
CommonParameter->>LoggingBridge: Install JUL to SLF4J and set gRPC log level
gRPC->>LoggingBridge: Emit diagnostic log
LoggingBridge->>Logback: Forward log to async appender
Logback->>LogFile: Append application log entry
Node->>ShutdownHook: Trigger TronLogShutdownHook on shutdown
ShutdownHook->>ShutdownHook: Wait up to max time for graceful shutdown
ShutdownHook->>Logback: Request async queue flush with timeout
Logback->>LogFile: Persist remaining log entries before stop
Generated by CodeAnt AI |
|
CodeAnt AI finished running the review. Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
ee010fd to
5374d8b
Compare
|
CodeAnt AI is running Incremental review Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
|
@CodeAnt-AI: review |
|
CodeAnt AI Incremental review completed. |
|
CodeAnt AI is running the review. Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
|
CodeAnt AI finished running the review. Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
1 similar comment
|
CodeAnt AI finished running the review. Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
|
CodeAnt AI is running the review. Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
Sequence DiagramThis PR routes Java Util Logging (including gRPC and Netty) into the main Logback configuration via a JUL to SLF4J bridge and extends the shutdown hook to wait longer and flush the async appender, reducing lost logs during shutdown. sequenceDiagram
participant App
participant JULLibraries
participant SLF4JBridge
participant Logback
participant ShutdownHook
App->>App: Initialize common parameters
App->>SLF4JBridge: Install JUL to SLF4J bridge
JULLibraries->>SLF4JBridge: Emit JUL log events
SLF4JBridge->>Logback: Forward events to configured appenders
App->>ShutdownHook: Trigger node shutdown
ShutdownHook->>ShutdownHook: Wait for graceful shutdown up to max time
ShutdownHook->>Logback: Stop context and flush async appender queue
Generated by CodeAnt AI |
|
CodeAnt AI finished running the review. Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
|
CodeAnt AI is running Incremental review Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
|
CodeAnt AI Incremental review completed. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 937b6cf5f4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
937b6cf to
f881fd2
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f881fd2692
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
f881fd2 to
6762c56
Compare
|
CodeAnt AI is running Incremental review Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
|
CodeAnt AI Incremental review completed. |
6762c56 to
c722ab7
Compare
### What Changed - gRPC now appear in the application log instead of going only to standard error. - Database size stats are no longer printed at info level during startup, which reduces log noise. - Shutdown now waits longer before stopping the log system, giving pending messages more time to flush. - Async appender now allows up to 5 seconds to drain its queue on shutdown. - Interrupted shutdowns now show a clearer log message. - Test log config is INFO level. ### Impact `✅ Fewer missed gRPC error logs` `✅ Cleaner startup output` `✅ Fewer lost shutdown logs` `✅ Fewer test logs`
c722ab7 to
f0bcb34
Compare
Summary
Six operator-facing logging improvements:
tron.log. InstallSLF4JBridgeHandler(jul-to-slf4j) at the earliest startup point so grpc-java's JUL output is routed through Logback instead of bypassing it to stderr.DbStat.statProperty()moved to DEBUG — critical init messages are no longer buried.TronLogShutdownHookrefactored: constants named, max wait raised from 60 s to 180 s to give the node's executor pools realistic headroom to drain (each pool can take up to 120 s viaExecutorServiceManager.shutdownAndAwaitTermination).TransactionCapsule.logSlowSigVerify(...)emits INFO for any single verify > 50 ms.LevelDbDataSourceImplwraps the JNI-blockingfactory.open(...)in a watchdog: WARN after 60 s with a remediation hint pointing atToolkit.jar db archive.--log-configfails fast.LogService.load(...)throwsTronError(ErrCode.LOG_LOAD)on an unreadable--log-configpath. Previously, it silently fell back to the classpath default, misleading operators into thinking their custom config was active.Impact
tron.log; startup no longer dumps DB stats at INFO; a stuck LevelDBfactory.openemits one actionable WARN every 30 s pointing atToolkit.jar db archive.DEBUGtoINFOto reduce CI log volume so failures are easier to locate after a red build. Tests that genuinely rely on DEBUG opt in per-logger inlogback-test.xml.Release scope
Logging-only change: no API, no RPC, no network, no DB format change.