[CRIU] Re: [PATCH] show: Set log-level to LOG_WARN

Kir Kolyshkin kir at openvz.org
Mon Feb 27 07:22:10 EST 2012


On Feb 27, 2012 11:36 AM, "Pavel Emelyanov" <xemul at parallels.com> wrote:
>
> On 02/25/2012 06:23 PM, Cyrill Gorcunov wrote:
> > We use pr_info for "show" action so
> > adjust log-level accordingly.
>
> Show should dump info to STDOUT (not STDERR, as it is now :\ ) regardless
> of the loglevel.

Guys,

The source of the problem here is you mix logging with plain and simple
output.

Logging is for keeping track of what and then a program had done. Output is
what you specifically request to be printed. You can configure a program to
log to a file (or maybe syslog), but its output always go to stdout.

Therefore, no logging functions should be used for output such as one of
'show' command.

>
> > Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> > ---
> >  crtools.c |    2 ++
> >  1 files changed, 2 insertions(+), 0 deletions(-)
> >
> > diff --git a/crtools.c b/crtools.c
> > index fd7c707..3128135 100644
> > --- a/crtools.c
> > +++ b/crtools.c
> > @@ -399,6 +399,8 @@ int main(int argc, char *argv[])
> >               ret = cr_restore_tasks(pid, &opts);
> >               break;
> >       case 's':
> > +             if (log_level < LOG_WARN)
> > +                     set_loglevel(LOG_WARN);
> >               ret = cr_show(pid, &opts);
> >               break;
> >       default:
>
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://openvz.org/mailman/listinfo/criu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://openvz.org/pipermail/criu/attachments/20120227/125acbb2/attachment.html


More information about the CRIU mailing list