diff --git a/Dockerfile b/Dockerfile index e04b3c666e8..53647bc23ab 100644 --- a/Dockerfile +++ b/Dockerfile @@ -93,7 +93,7 @@ RUN mkdir /container-init.d \ VOLUME $IPFS_PATH # The default logging level -ENV IPFS_LOGGING "" +ENV GOLOG_LOG_LEVEL "" # This just makes sure that: # 1. There's an fs-repo, and initializes one if there isn't. diff --git a/cmd/ipfs/kubo/start.go b/cmd/ipfs/kubo/start.go index efde6e48e9b..5d8447a1073 100644 --- a/cmd/ipfs/kubo/start.go +++ b/cmd/ipfs/kubo/start.go @@ -226,7 +226,10 @@ func insideGUI() bool { func checkDebug(req *cmds.Request) { // check if user wants to debug. option OR env var. debug, _ := req.Options["debug"].(bool) - if debug || os.Getenv("IPFS_LOGGING") == "debug" { + ipfsLogLevel, _ := logging.LevelFromString(os.Getenv("IPFS_LOGGING")) // IPFS_LOGGING is deprecated + goLogLevel, _ := logging.LevelFromString(os.Getenv("GOLOG_LOG_LEVEL")) + + if debug || goLogLevel == logging.LevelDebug || ipfsLogLevel == logging.LevelDebug { u.Debug = true logging.SetDebugLogging() } diff --git a/core/commands/log.go b/core/commands/log.go index d2cb4a1a168..a9af0c2f379 100644 --- a/core/commands/log.go +++ b/core/commands/log.go @@ -22,12 +22,12 @@ var LogCmd = &cmds.Command{ 'ipfs log' contains utility commands to affect or read the logging output of a running daemon. -There are also two environmental variables that direct the logging +There are also two environmental variables that direct the logging system (not just for the daemon logs, but all commands): - IPFS_LOGGING - sets the level of verbosity of the logging. + GOLOG_LOG_LEVEL - sets the level of verbosity of the logging. One of: debug, info, warn, error, dpanic, panic, fatal - IPFS_LOGGING_FMT - sets formatting of the log output. - One of: color, nocolor + GOLOG_LOG_FMT - sets formatting of the log output. + One of: color, nocolor, json `, }, diff --git a/docs/changelogs/v0.34.md b/docs/changelogs/v0.34.md index 773d942fe46..327b021c287 100644 --- a/docs/changelogs/v0.34.md +++ b/docs/changelogs/v0.34.md @@ -8,7 +8,7 @@ - [๐Ÿ”ฆ Highlights](#-highlights) - [RPC and CLI command changes](#rpc-and-cli-command-changes) - [Bitswap improvements from Boxo](#bitswap-improvements-from-boxo) -- [๐Ÿ“ Changelog](#-changelog) + - [IPFS_LOG_LEVEL deprecated](#ipfs_log_level-deprecated) - [๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ Contributors](#-contributors) ### Overview @@ -25,6 +25,8 @@ This release includes performance and reliability improvements and fixes for minor resource leaks. One of the performance changes [greatly improves the bitswap clients ability to operate under high load](https://github.com/ipfs/boxo/pull/817#pullrequestreview-2587207745), that could previously result in an out of memory condition. -### ๐Ÿ“ Changelog +#### `IPFS_LOG_LEVEL` deprecated + +The variable has been deprecated. Please use [`GOLOG_LOG_LEVEL`](https://github.com/ipfs/kubo/blob/master/docs/environment-variables.md#golog_log_level) instead for configuring logging levels. ### ๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ Contributors diff --git a/plugin/plugins/peerlog/peerlog.go b/plugin/plugins/peerlog/peerlog.go index d55a7f0b9e1..5aa11a6eb1c 100644 --- a/plugin/plugins/peerlog/peerlog.go +++ b/plugin/plugins/peerlog/peerlog.go @@ -40,7 +40,7 @@ type plEvent struct { // // Usage: // -// GOLOG_FILE=~/peer.log IPFS_LOGGING_FMT=json ipfs daemon +// GOLOG_FILE=~/peer.log GOLOG_LOG_FMT=json ipfs daemon // // Output: // @@ -186,7 +186,7 @@ func (pl *peerLogPlugin) Start(node *core.IpfsNode) error { return nil } - // Ensure logs from this plugin get printed regardless of global IPFS_LOGGING value + // Ensure logs from this plugin get printed regardless of global GOLOG_LOG_LEVEL value if err := logging.SetLogLevel("plugin/peerlog", "info"); err != nil { return fmt.Errorf("failed to set log level: %w", err) } diff --git a/test/3nodetest/bootstrap/Dockerfile b/test/3nodetest/bootstrap/Dockerfile index ed8ac9ffa52..e5423f11660 100644 --- a/test/3nodetest/bootstrap/Dockerfile +++ b/test/3nodetest/bootstrap/Dockerfile @@ -6,6 +6,6 @@ RUN mv -f /tmp/id/config /root/.ipfs/config RUN ipfs id ENV IPFS_PROF true -ENV IPFS_LOGGING_FMT nocolor +ENV GOLOG_LOG_FMT nocolor EXPOSE 4011 4012/udp diff --git a/test/3nodetest/client/Dockerfile b/test/3nodetest/client/Dockerfile index d4e1ffa36d4..3e7ada6c05d 100644 --- a/test/3nodetest/client/Dockerfile +++ b/test/3nodetest/client/Dockerfile @@ -8,7 +8,7 @@ RUN ipfs id EXPOSE 4031 4032/udp ENV IPFS_PROF true -ENV IPFS_LOGGING_FMT nocolor +ENV GOLOG_LOG_FMT nocolor ENTRYPOINT ["/bin/bash"] CMD ["/tmp/id/run.sh"] diff --git a/test/3nodetest/fig.yml b/test/3nodetest/fig.yml index 18a28c8ff75..f163398c2af 100644 --- a/test/3nodetest/fig.yml +++ b/test/3nodetest/fig.yml @@ -11,7 +11,7 @@ bootstrap: - "4011" - "4012/udp" environment: - IPFS_LOGGING: debug + GOLOG_LOG_LEVEL: debug server: build: ./server @@ -23,7 +23,7 @@ server: - "4021" - "4022/udp" environment: - IPFS_LOGGING: debug + GOLOG_LOG_LEVEL: debug client: build: ./client @@ -35,4 +35,4 @@ client: - "4031" - "4032/udp" environment: - IPFS_LOGGING: debug + GOLOG_LOG_LEVEL: debug diff --git a/test/3nodetest/server/Dockerfile b/test/3nodetest/server/Dockerfile index 935d2e1b022..72f6fdf57ef 100644 --- a/test/3nodetest/server/Dockerfile +++ b/test/3nodetest/server/Dockerfile @@ -9,7 +9,7 @@ RUN chmod +x /tmp/test/run.sh EXPOSE 4021 4022/udp ENV IPFS_PROF true -ENV IPFS_LOGGING_FMT nocolor +ENV GOLOG_LOG_FMT nocolor ENTRYPOINT ["/bin/bash"] CMD ["/tmp/test/run.sh"] diff --git a/test/sharness/README.md b/test/sharness/README.md index 6ab8539da2c..239e46d1eb4 100644 --- a/test/sharness/README.md +++ b/test/sharness/README.md @@ -13,7 +13,7 @@ The usual ipfs env flags also apply: ```sh # the output will make your eyes bleed -IPFS_LOGGING=debug TEST_VERBOSE=1 make +GOLOG_LOG_LEVEL=debug TEST_VERBOSE=1 make ``` To make the tests abort as soon as an error occurs, use the TEST_IMMEDIATE env variable: