fix: switch away from IPFS_LOG_LEVEL (#10694)
Russell Dempsey committed
Feb 14, 2025 at 12:25 UTC
40a7a388a4df26a14e2866dd978f4fc2b2a1f14d
10 files changed
+22
-17
Dockerfile
+1
-1
@@ -93,7 +93,7 @@ RUN mkdir /container-init.d \
93
VOLUME $IPFS_PATH
94
95
# The default logging level
96
-ENV IPFS_LOGGING ""
96
+ENV GOLOG_LOG_LEVEL ""
97
98
# This just makes sure that:
99
# 1. There's an fs-repo, and initializes one if there isn't.
cmd/ipfs/kubo/start.go
+4
-1
@@ -226,7 +226,10 @@ func insideGUI() bool {
226
func checkDebug(req *cmds.Request) {
227
// check if user wants to debug. option OR env var.
228
debug, _ := req.Options["debug"].(bool)
229
- if debug || os.Getenv("IPFS_LOGGING") == "debug" {
229
+ ipfsLogLevel, _ := logging.LevelFromString(os.Getenv("IPFS_LOGGING")) // IPFS_LOGGING is deprecated
230
+ goLogLevel, _ := logging.LevelFromString(os.Getenv("GOLOG_LOG_LEVEL"))
231
+
232
+ if debug || goLogLevel == logging.LevelDebug || ipfsLogLevel == logging.LevelDebug {
233
u.Debug = true
234
logging.SetDebugLogging()
235
}
core/commands/log.go
+4
-4
@@ -22,12 +22,12 @@ var LogCmd = &cmds.Command{
22
'ipfs log' contains utility commands to affect or read the logging
23
output of a running daemon.
24
25
-There are also two environmental variables that direct the logging
25
+There are also two environmental variables that direct the logging
26
system (not just for the daemon logs, but all commands):
27
- IPFS_LOGGING - sets the level of verbosity of the logging.
27
+ GOLOG_LOG_LEVEL - sets the level of verbosity of the logging.
28
One of: debug, info, warn, error, dpanic, panic, fatal
29
- IPFS_LOGGING_FMT - sets formatting of the log output.
30
- One of: color, nocolor
29
+ GOLOG_LOG_FMT - sets formatting of the log output.
30
+ One of: color, nocolor, json
31
`,
32
},
33
docs/changelogs/v0.34.md
+4
-2
@@ -8,7 +8,7 @@
8
- [🔦 Highlights](#-highlights)
9
- [RPC and CLI command changes](#rpc-and-cli-command-changes)
10
- [Bitswap improvements from Boxo](#bitswap-improvements-from-boxo)
11
-- [📝 Changelog](#-changelog)
11
+ - [IPFS_LOG_LEVEL deprecated](#ipfs_log_level-deprecated)
12
- [👨👩👧👦 Contributors](#-contributors)
13
14
### Overview
@@ -25,6 +25,8 @@
25
26
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.
27
28
-### 📝 Changelog
28
+#### `IPFS_LOG_LEVEL` deprecated
29
+
30
+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.
31
32
### 👨👩👧👦 Contributors
plugin/plugins/peerlog/peerlog.go
+2
-2
@@ -40,7 +40,7 @@ type plEvent struct {
40
//
41
// Usage:
42
//
43
-// GOLOG_FILE=~/peer.log IPFS_LOGGING_FMT=json ipfs daemon
43
+// GOLOG_FILE=~/peer.log GOLOG_LOG_FMT=json ipfs daemon
44
//
45
// Output:
46
//
@@ -186,7 +186,7 @@ func (pl *peerLogPlugin) Start(node *core.IpfsNode) error {
186
return nil
187
}
188
189
- // Ensure logs from this plugin get printed regardless of global IPFS_LOGGING value
189
+ // Ensure logs from this plugin get printed regardless of global GOLOG_LOG_LEVEL value
190
if err := logging.SetLogLevel("plugin/peerlog", "info"); err != nil {
191
return fmt.Errorf("failed to set log level: %w", err)
192
}
test/3nodetest/bootstrap/Dockerfile
+1
-1
@@ -6,6 +6,6 @@ RUN mv -f /tmp/id/config /root/.ipfs/config
6
RUN ipfs id
7
8
ENV IPFS_PROF true
9
-ENV IPFS_LOGGING_FMT nocolor
9
+ENV GOLOG_LOG_FMT nocolor
10
11
EXPOSE 4011 4012/udp
test/3nodetest/client/Dockerfile
+1
-1
@@ -8,7 +8,7 @@ RUN ipfs id
8
EXPOSE 4031 4032/udp
9
10
ENV IPFS_PROF true
11
-ENV IPFS_LOGGING_FMT nocolor
11
+ENV GOLOG_LOG_FMT nocolor
12
13
ENTRYPOINT ["/bin/bash"]
14
CMD ["/tmp/id/run.sh"]
test/3nodetest/fig.yml
+3
-3
@@ -11,7 +11,7 @@ bootstrap:
11
- "4011"
12
- "4012/udp"
13
environment:
14
- IPFS_LOGGING: debug
14
+ GOLOG_LOG_LEVEL: debug
15
16
server:
17
build: ./server
@@ -23,7 +23,7 @@ server:
23
- "4021"
24
- "4022/udp"
25
environment:
26
- IPFS_LOGGING: debug
26
+ GOLOG_LOG_LEVEL: debug
27
28
client:
29
build: ./client
@@ -35,4 +35,4 @@ client:
35
- "4031"
36
- "4032/udp"
37
environment:
38
- IPFS_LOGGING: debug
38
+ GOLOG_LOG_LEVEL: debug
test/3nodetest/server/Dockerfile
+1
-1
@@ -9,7 +9,7 @@ RUN chmod +x /tmp/test/run.sh
9
EXPOSE 4021 4022/udp
10
11
ENV IPFS_PROF true
12
-ENV IPFS_LOGGING_FMT nocolor
12
+ENV GOLOG_LOG_FMT nocolor
13
14
ENTRYPOINT ["/bin/bash"]
15
CMD ["/tmp/test/run.sh"]
test/sharness/README.md
+1
-1
@@ -13,7 +13,7 @@ The usual ipfs env flags also apply:
13
14
```sh
15
# the output will make your eyes bleed
16
-IPFS_LOGGING=debug TEST_VERBOSE=1 make
16
+GOLOG_LOG_LEVEL=debug TEST_VERBOSE=1 make
17
```
18
19
To make the tests abort as soon as an error occurs, use the TEST_IMMEDIATE env variable: