Skip to content

logging: enable file/line info if --debug is set#2911

Merged
AkihiroSuda merged 1 commit intoopencontainers:masterfrom
kolyshkin:debug-enable-file-line
Apr 28, 2021
Merged

logging: enable file/line info if --debug is set#2911
AkihiroSuda merged 1 commit intoopencontainers:masterfrom
kolyshkin:debug-enable-file-line

Conversation

@kolyshkin
Copy link
Copy Markdown
Contributor

This helps a lot to find out where the errors come from.

Before:

level=warning msg="lstat /sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/test_hello: no such file or directory"

After:

level=warning msg="lstat /sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/test_hello: no such file or directory" func=github.com/opencontainers/runc/libcontainer.destroy file="github.com/opencontainers/runc/libcontainer/state_linux.go:44"

Presumably this comes with an overhead, but I guess no one is using
--debug by default anyway.

PS I'd love to cut the 'github.com/opencontainers/runc/` prefix but don't see an easy way to :-\

This helps a lot to find out where the errors come from.

Before:
> level=warning msg="lstat /sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/test_hello: no such file or directory"

After:
> level=warning msg="lstat /sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/test_hello: no such file or directory" func=github.com/opencontainers/runc/libcontainer.destroy file="github.com/opencontainers/runc/libcontainer/state_linux.go:44"

Presumably this comes with an overhead, but I guess no one is using
--debug by default anyway.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Copy link
Copy Markdown
Member

@fuweid fuweid left a comment

Choose a reason for hiding this comment

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

LGTM(nb)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants