Skip to content

itest: separate tapd instance logs into per-node files #1987

@darioAnongba

Description

@darioAnongba

When running integration tests with multiple tapd instances (e.g., Alice, Bob, Dave, Erin), all tapd logs are intermingled in a single console output alongside the test logs. This makes debugging multi-node scenarios very difficult.

Motivation

As integration tests have evolved from single-node "end-to-end" tests to true multi-node scenarios (minting on Alice, sending to Bob, validating on Dave), each tapd instance is independent and its logs should be separate. Currently:

  • All tapd subsystem logs (TAPD, TSVR,, GRDN, etc.) from all tapd instances go to the same console output.
  • Test-level logs (t.Logf) are mixed in with daemon logs.
  • When a test fails, identifying which tapd instance produced an error requires manually parsing interleaved log lines.
  • LND node logs are already written to separate per-node files (via lntest/node framework), making tapd behave differently.
  • AI agents need separate, small and persisted log files for easier debugging.

Current Architecture (Why This Happens)

tapd instances run in-process during itests. The logging setup in test_harness.go:setupLogging() creates a single shared SubLoggerManager and calls tap.SetupLoggers() once, which replaces all global package-level loggers. Every tapd instance created via CreateServerFromConfig() shares these global loggers.

The RotatingLogWriter is never initialized with InitLogRotator, so all log output goes to console (stdout) only.

Since Go package-level loggers are process-global, there is no way to separate per-instance logs when multiple instances run in the same process.

Expected Log Structure After

regtest/
  0-testBasicSend-Alice.log              # LND node logs
  1-testBasicSend-Bob.log                # LND node logs
  tapd-testBasicSend-Alice.log           # tapd instance logs
  tapd-testBasicSend-Bob.log             # tapd instance logs
  tapd-testBasicSend-uni-server.log      # Universe server tapd logs
  output_btcd_chainbackend.log           # Chain backend logs

Each tapd log file contains the full daemon output for that specific instance, with all subsystem prefixes (TAPD, TSVR, TRPC, GRDN, PRUF, etc.) scoped to that one node.

Metadata

Metadata

Assignees

Type

Projects

Status

🏗 In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions