Re: [PATCH] log: fix log level print in older kernels

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi John,

-----Original Message-----
> In older kernels, the log level and the log priority are not
> separated.  Since the log level is only the last three bits,
> print only those last three bits when using 'log -m'.

It seems that it's the log flags, not priority, and currently this is
the intended output:

$ crash -h log

    -m  Display the message log level in brackets preceding each message.  For
        the variable-length record format, the level will be displayed in 
        hexadecimal, and depending upon the kernel version, also contains the
        facility or flags bits.

But I'm fine with this change, because crash shows only the log level on
5.10+ kernels again and I think the flags is not often needed for analysis
and the flags/level value can be shown by "set debug 1" if needed.

So could you modify also the help description and commit message?

Thanks,
Kazu


> 
> Suggested-by: David Jeffery <djeffery@xxxxxxxxxx>
> Signed-off-by: John Pittman <jpittman@xxxxxxxxxx>
> ---
>  defs.h   | 1 +
>  kernel.c | 2 ++
>  2 files changed, 3 insertions(+)
> 
> diff --git a/defs.h b/defs.h
> index 35cdac2..35b983a 100644
> --- a/defs.h
> +++ b/defs.h
> @@ -5627,6 +5627,7 @@ void clone_bt_info(struct bt_info *, struct bt_info *, struct task_context *);
>  void dump_kernel_table(int);
>  void dump_bt_info(struct bt_info *, char *where);
>  void dump_log(int);
> +#define LOG_LEVEL(v) ((v) & 0x07)
>  #define SHOW_LOG_LEVEL (0x1)
>  #define SHOW_LOG_DICT  (0x2)
>  #define SHOW_LOG_TEXT  (0x4)
> diff --git a/kernel.c b/kernel.c
> index ac765e3..735263c 100644
> --- a/kernel.c
> +++ b/kernel.c
> @@ -5262,6 +5262,8 @@ dump_log_entry(char *logptr, int msg_flags)
>  		fprintf(fp, "%s", buf);
>  	}
> 
> +	level = LOG_LEVEL(level);
> +
>  	if (msg_flags & SHOW_LOG_LEVEL) {
>  		sprintf(buf, "<%x>", level);
>  		ilen += strlen(buf);
> --
> 2.17.2


--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility




[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux