New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[1.10] Add log-level option to conmon and crio.conf #1692
Conversation
/test all |
@umohnani8 Let us also port this to master and release-1.11. Thank! |
Can we get a flag to optionally keep this? It seems valuable for debugging Podman. |
@mrunalp should I go ahead and add a flag? If so, what do we want to call the flag. |
Can you just make it debug versus info? |
@rhatdan The debug change doesn't work as it just changes what gets printed in the logs. We would need to add a flag to control it. |
conmon/conmon.c
Outdated
@@ -80,6 +80,18 @@ | |||
syslog(LOG_INFO, "conmon <ninfo>: " fmt " \n", ##__VA_ARGS__); \ | |||
} while (0) | |||
|
|||
#define ndebug(s) \ | |||
do { \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be better to include the if(opt_debug)
in the macros so all debug prints will only happen if debug is set.
Why do you need this for debugging @mheon? Do you have or had any use case that helps you debug with this information? If this is successful the pid is sent back to golang where if in not wrong is printed somewhere, if not, we can add it there. |
Our most successful debug strategy for conmon problems now is to have
people copy the command line libpod would use to launch it and then run it
themselves and see what happens. It lets us get output more reliably than
forwarding to Go with the added benefit that we can easily stick strace on
there if needed to get a better picture of where it's failing. Having the
container pid actually printed is useful there.
…On Thu, Jul 12, 2018, 02:43 Antonio Murdaca ***@***.***> wrote:
Why do you need this for debugging @mheon <https://github.com/mheon>? Do
you have or had any use case that helps you debug with this information? If
this is successful the pid is sent back to golang where if in not wrong is
printed somewhere, if not, we can add it there.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1692 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHYHCLt_N4yQmZRq3n7VmzOWFsM0Z-N-ks5uFvAEgaJpZM4VLgF0>
.
|
yeah that's exactly what we do as well to debug conmon, I still can't see how the pid printed after conmon starts is useful, but ok. |
93b9213
to
a362df2
Compare
/test all |
We decided to add support for log-level instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM, any man page adjustments needed?
/test all |
@TomSweeneyRedHat thanks! Added doc changes. |
/test all |
@@ -163,7 +163,7 @@ Description=OCI-based implementation of Kubernetes Container Runtime Interface | |||
Documentation=https://github.com/kubernetes-incubator/cri-o | |||
|
|||
[Service] | |||
ExecStart=/usr/local/bin/crio --log-level debug | |||
ExecStart=/usr/local/bin/crio |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to show an example in crio.conf how to set up the debug level. Also based on the registry.conf discussions this morning, does the registries option at line 150 still hold?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is fine, for 1.10 and below we need to add the default registries in /etc/crio/crio.conf
.
Added an "optional" to show how we can change the log_level in crio.conf.
Kata does not work on 1.10, so we can ignore that I believe. |
/test e2e_rhel |
c455fa4
to
3e02a0b
Compare
conmon/conmon.c
Outdated
@@ -171,6 +196,7 @@ static GOptionEntry opt_entries[] = | |||
{ "log-size-max", 0, 0, G_OPTION_ARG_INT64, &opt_log_size_max, "Maximum size of log file", NULL }, | |||
{ "socket-dir-path", 0, 0, G_OPTION_ARG_STRING, &opt_socket_path, "Location of container attach sockets", NULL }, | |||
{ "version", 0, 0, G_OPTION_ARG_NONE, &opt_version, "Print the version and exit", NULL }, | |||
{ "log-level", 0, 0, G_OPTION_ARG_INT, &opt_log_level, "Print debug logs based on log level", NULL }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should read this as ARG_STRING and map it to int for log_level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But then logrus already maps the levels to int, so isn't it better to use that instead of creating a new string to int map of the levels in conmon?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
b3d45c4
to
d4c0fb9
Compare
conmon/conmon.c
Outdated
} | ||
|
||
#define ndebug(s) \ | ||
if (parse_level(opt_log_level) > 2) { \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 doesn't match the enum values you have defined below. We should use the enum constants instead of number in this comparison.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
/test all |
/test e2e_rhel |
1 similar comment
/test e2e_rhel |
conmon now has a --log-level flag that changes the verbosity of the logs based on the value it is set to. From logrus, panic(0), fatal(1), error(2) tells conmon to print all pexit and nexit logs (this is the default). warn(3) adds the nwarn logs, info(4) adds the ninfo logs, and finally debug(5) adds the ndebug logs as well. Adds a log_level field in the crio.conf that can have the following options: panic, fatal, error, warn, info, and debug. Changes default from info to error. Signed-off-by: umohnani8 <umohnani@redhat.com>
/test all |
@@ -229,9 +232,9 @@ func main() { | |||
}, | |||
cli.StringFlag{ | |||
Name: "log-level", | |||
Usage: "log messages above specified level: debug, info (default), warn, error, fatal or panic", | |||
Value: "error", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we sure about this default? what was before this change overall?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was info. We want the logs to be as minimal as possible by default so error seems like the best choice. When we change this in crio.conf the logs get more verbose for both cri-o and conmon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome, we're good then (error's super fine!)
LGTM |
conmon now has a --log-level flag that changes
the verbosity of the logs based on the value it
is set to. From logrus, panic(0), fatal(1), error(2) tells
conmon to print all pexit and nexit logs (this
is the default). warn(3) adds the nwarn logs, info(4)
adds the ninfo logs, and finally debug(5) adds the ndebug
logs as well.
Adds a log_level field in the crio.conf that can have the
following options: panic, fatal, error, warn, info, and debug.
Changes default from info to error.
Signed-off-by: umohnani8 umohnani@redhat.com