Skip to content

feat(log): improve log for gRPC, DB, and shutdown#6700

Open
halibobo1205 wants to merge 7 commits intotronprotocol:developfrom
halibobo1205:feat/log_grpc
Open

feat(log): improve log for gRPC, DB, and shutdown#6700
halibobo1205 wants to merge 7 commits intotronprotocol:developfrom
halibobo1205:feat/log_grpc

Conversation

@halibobo1205
Copy link
Copy Markdown
Collaborator

Summary

Closes #6583.

Six operator-facing logging improvements:

  1. gRPC logs land in tron.log. Install SLF4JBridgeHandler (jul-to-slf4j) at the earliest startup point so grpc-java's JUL output is routed through Logback instead of bypassing it to stderr; io.grpc inherits root INFO so NettyServerTransport's "Transport failed" JUL-INFO diagnostics (TLS handshake failures, unexpected resets, and other non-quiet exceptions) actually reach tron.log.
  2. DB stats no longer flood startup at INFO. DbStat.statProperty() moved to DEBUG — critical init messages are no longer buried.
  3. Shutdown logs are complete. TronLogShutdownHook refactored: 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 via ExecutorServiceManager.shutdownAndAwaitTermination).
  4. Slow signature verifications are visible. TransactionCapsule.logSlowSigVerify(...) emits INFO for any single verify > 50 ms.
  5. LevelDB open stalls are no longer silent. LevelDbDataSourceImpl wraps the JNI-blocking factory.open(...) in a watchdog: WARN after 60 s with a remediation hint pointing at Toolkit.jar db archive.
  6. Invalid --log-config fails fast. LogService.load(...) throws TronError(ErrCode.LOG_LOAD) on an unreadable --log-config path. Previously, it silently fell back to the classpath default, misleading operators into thinking their custom config was active.

Impact

  • tron.log: grpc TLS/handshake/connection-reset diagnostics now land in tron.log; startup no longer dumps DB stats at INFO; a stuck LevelDB factory.open emits one actionable WARN every 30 s pointing at Toolkit.jar db archive.
  • CI output: test root logger moved from DEBUG to INFO to reduce CI log volume so failures are easier to locate after a red build. Tests that genuinely rely on DEBUG opt in per-logger in logback-test.xml.

Release scope

Logging-only change: no API, no RPC, no network, no DB format change.

### 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`
@halibobo1205
Copy link
Copy Markdown
Collaborator Author

The coverage delta is dominated by BlockEventGet: 87.65% → 54.73% (+80 missed lines). Root cause is EventPluginLoader singleton pollution from FilterQueryTest — the same bug being fixed in #6688 (commit [ab0db5f0](https://github.com/tronprotocol/java-tron/pull/6688/commits/ab0db5f0ea23e7f5e6c3f1a66dbe5beb5735b80a)). None of the regressing classes are in this PR's diff. Will re-check after #6688 lands.

@halibobo1205 halibobo1205 changed the title feat(log): improve operator log visibility for gRPC, DB, and shutdown feat(log): improve log for gRPC, DB, and shutdown Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve logging: SLF4J bridge, less startup noise, fix shutdown log loss

4 participants