diff --git a/client/src/main.cpp b/client/src/main.cpp index f02ddbc46..408e1112d 100644 --- a/client/src/main.cpp +++ b/client/src/main.cpp @@ -222,12 +222,24 @@ int main(int argc, char* argv[]) { } } + // The snapshot commands end before Peer sets the logger up. Without it Boost.Log prints every + // record of the import, hundreds of thousands of debug and trace lines, to the console: the + // configured levels apply to them as to a running node. + const bool snapshotCommand = vm.count("download-snapshot") > 0 || vm.count("import-snapshot") > 0 || vm.count("export-snapshot") > 0; + if (snapshotCommand) { + logger::initialize(config.getLoggerSettings()); + } + auto finishCommand = [](int code) { + logger::cleanup(); + return code; + }; + // no keys needed: the import writes only the database, the caches and the checkpoint if (vm.count("download-snapshot") > 0) { - return snapshot_export::runDownload(config, vm["download-snapshot"].as()); + return finishCommand(snapshot_export::runDownload(config, vm["download-snapshot"].as())); } if (vm.count("import-snapshot") > 0) { - return snapshot_export::runImport(config, vm["import-snapshot"].as()); + return finishCommand(snapshot_export::runImport(config, vm["import-snapshot"].as())); } if (vm.count(cmdline::argSeed) == 0) { @@ -242,7 +254,7 @@ int main(int argc, char* argv[]) { } if (vm.count("export-snapshot") > 0) { - return snapshot_export::run(config, vm["export-snapshot"].as()); + return finishCommand(snapshot_export::run(config, vm["export-snapshot"].as())); } if (vm.count(cmdline::argDumpKeys) > 0) { diff --git a/docs/CHANGES.md b/docs/CHANGES.md index 574195948..9ebd4eba1 100644 --- a/docs/CHANGES.md +++ b/docs/CHANGES.md @@ -41,6 +41,7 @@ lines under the new release. | #114 | the node builds and passes its tests on Windows (MSVC, x64) and macOS (Apple Silicon): POSIX-only code behind `lib/system/platform.hpp`, the database lock now also on Windows, a new `build-platforms.yml` workflow; the release workflow also makes a Windows `.zip` and a macOS package (with Eclipse Temurin 11), kept as artifacts until a mainnet state-digest check on each system | | #115 | Windows and macOS nodes load the checkpoints and snapshots of Linux and sync mainnet with the same state digests: the binary checkpoint header records `long` as 8 bytes on every system (`cs::ArchiveOutput`, read back by `cs::ArchiveInput`), checkpoint text files are read and written in binary mode, macOS Boost is built as C++17; `Transport` releases the routing table with the p2p host, fixing a use-after-free at exit (a crash on macOS); a platform consensus check in CI | | #116 | snapshot: `node --survey-snapshots [seconds]` asks the neighbours for the snapshots they serve without opening the chain and prints what they declared; the weekly known-hosts job turns it into `snapshots.md` and `snapshot_sources.txt` (shipped in the packages when present) | +| #117 | client: `--download-snapshot`, `--import-snapshot` and `--export-snapshot` start the logger with the configured levels; they printed every debug and trace record of the import to the console (about 684,000 lines for one `--download-snapshot`, the Docker first start included) | ## community.13 — 2026-10-26