Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 4 additions & 1 deletion cmd/ipfs/kubo/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Comment on lines +229 to +232
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

based on the documentation at https://github.com/ipfs/go-log#usage I think this should do what we want (support non-deprecated env var, still allow old one..)

This change also corrects functionality to where export GOLOG_LOG_LEVEL="debug,subsystem=info" will actually enable debug logging, instead of potentially not.

AFAIK, "debug,system=info" == "debug" would have previously returned false. Idk if that was intended or not.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm... this only works for simple "debug", but that was also true before, so not a blocker for this PR.

(The LevelFromString is backed by https://github.com/uber-go/zap/blob/fcf8ee58669e358bbd6460bef5c2ee7a53c0803a/zapcore/level.go#L180 which is matching string exactly and debug,subsystem=info will return false.)

u.Debug = true
logging.SetDebugLogging()
}
Expand Down
8 changes: 4 additions & 4 deletions core/commands/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
`,
},

Expand Down
6 changes: 4 additions & 2 deletions docs/changelogs/v0.34.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
4 changes: 2 additions & 2 deletions plugin/plugins/peerlog/peerlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
//
Expand Down Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion test/3nodetest/bootstrap/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion test/3nodetest/client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
6 changes: 3 additions & 3 deletions test/3nodetest/fig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ bootstrap:
- "4011"
- "4012/udp"
environment:
IPFS_LOGGING: debug
GOLOG_LOG_LEVEL: debug

server:
build: ./server
Expand All @@ -23,7 +23,7 @@ server:
- "4021"
- "4022/udp"
environment:
IPFS_LOGGING: debug
GOLOG_LOG_LEVEL: debug

client:
build: ./client
Expand All @@ -35,4 +35,4 @@ client:
- "4031"
- "4032/udp"
environment:
IPFS_LOGGING: debug
GOLOG_LOG_LEVEL: debug
2 changes: 1 addition & 1 deletion test/3nodetest/server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
2 changes: 1 addition & 1 deletion test/sharness/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading