Skip to content

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

Merged
lvs0075 merged 13 commits into
tronprotocol:developfrom
halibobo1205:feat/log_grpc
May 8, 2026
Merged

feat(log): improve log for gRPC, DB, and shutdown#6700
lvs0075 merged 13 commits into
tronprotocol:developfrom
halibobo1205:feat/log_grpc

Conversation

@halibobo1205
Copy link
Copy Markdown
Collaborator

@halibobo1205 halibobo1205 commented Apr 23, 2026

Summary

Closes #6583.

Six operator-facing logging improvements:

  1. gRPC logs route through Logback into a dedicated grpc.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 is configured at INFO and written to ./logs/grpc/grpc.log, so NettyServerTransport's "Transport failed" JUL-INFO diagnostics (TLS handshake failures, unexpected resets, and other non-quiet exceptions) are captured in managed log files.
  2. DB stats no longer flood startup at INFO. DbStat.statProperty() moved to DEBUG, so 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.
  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.

Impact

  • grpc.log: gRPC TLS/handshake/connection-reset diagnostics now land in ./logs/grpc/grpc.log instead of stderr.
  • tron.log: startup no longer dumps DB stats at INFO; slow signature verification and stuck LevelDB open diagnostics remain operator-visible in the main managed logs.
  • CI output: test root logger moved from DEBUG to INFO to reduce CI log volume.

Release scope

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

@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
Comment thread build.gradle
Comment thread chainbase/src/main/java/org/tron/core/capsule/TransactionCapsule.java Outdated
Comment thread common/src/main/java/org/tron/common/log/LogService.java Outdated
Copy link
Copy Markdown
Collaborator

@waynercheung waynercheung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

### 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`
@lvs0075 lvs0075 merged commit 2c307c8 into tronprotocol:develop May 8, 2026
11 checks passed
@github-project-automation github-project-automation Bot moved this to Done in java-tron May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

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

6 participants