You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Corda或CorDapp中提高Kryo日志级别?

How to Enable Kryo TRACE Logging in Corda or Your CorDapp

Absolutely! You can enable Kryo's TRACE-level logging in Corda or your CorDapp—you don’t need to call Kryo’s native Log.TRACE() directly, since Corda bridges Kryo’s logging to SLF4J (the standard logging framework it uses). Here are two straightforward methods to get those detailed serialization logs:

Method 1: Modify the Corda Node’s Log Configuration File

Corda uses Logback by default, so you’ll need to edit your node’s logback.xml (or logback-test.xml for testing environments) to explicitly set the log level for Kryo packages. Add these lines to the configuration:

<!-- Enable TRACE logging for core Kryo functionality -->
<logger name="com.esotericsoftware.kryo" level="TRACE" />

<!-- Optional: Enable TRACE for Kryo's IO module to get low-level serialization/deserialization details -->
<logger name="com.esotericsoftware.kryo.io" level="TRACE" />

Once you’ve saved the changes, restart your Corda node. This will make the node output all TRACE-level logs from Kryo, including every step of object serialization and deserialization.

Method 2: Dynamically Set Log Level in Your CorDapp Code

If you need to adjust the log level on the fly (without restarting the node) or want to scope it to your CorDapp only, you can use SLF4J’s API to modify the log level programmatically. Add this code to your Flow, service, or initialization logic:

import org.slf4j.LoggerFactory
import ch.qos.logback.classic.Level
import ch.qos.logback.classic.Logger

// Get the logger for the core Kryo package
val kryoLogger = LoggerFactory.getLogger("com.esotericsoftware.kryo") as Logger
// Set the log level to TRACE
kryoLogger.level = Level.TRACE

// Optional: Target Kryo's IO module for more granular logs
val kryoIoLogger = LoggerFactory.getLogger("com.esotericsoftware.kryo.io") as Logger
kryoIoLogger.level = Level.TRACE

Notes for This Approach:

  • This change is temporary—it will reset to the node’s config file settings when the node restarts.
  • Make sure your CorDapp has access to Logback’s API (Corda’s base dependencies include this, so you shouldn’t need to add extra jars).

Important Considerations

  • Kryo’s TRACE logs are extremely verbose—they’ll output every detail of serialization, which can slow down your node significantly. Be sure to revert the log level back to INFO or WARN once you’ve finished troubleshooting.
  • If your node uses a different logging framework (uncommon, since Corda defaults to Logback), the configuration steps will vary, but the core idea is the same: target the com.esotericsoftware.kryo package and set its level to TRACE.
  • Avoid calling Kryo’s native Log.TRACE() method directly. Corda’s integration with SLF4J overrides Kryo’s default logging, so direct calls won’t feed into the node’s standard logging system and may not work as expected.

内容的提问来源于stack exchange,提问作者Jimmy Thompson

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 08:22:41