[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<BL4PR21MB4627E73164911623CFB98BADBFAC2@BL4PR21MB4627.namprd21.prod.outlook.com>
Date: Tue, 1 Apr 2025 19:18:04 +0000
From: Dexuan Cui <decui@...rosoft.com>
To: Shradha Gupta <shradhagupta@...ux.microsoft.com>
CC: KY Srinivasan <kys@...rosoft.com>, Haiyang Zhang <haiyangz@...rosoft.com>,
Wei Liu <wei.liu@...nel.org>, "linux-hyperv@...r.kernel.org"
<linux-hyperv@...r.kernel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, Shradha Gupta <shradhagupta@...rosoft.com>
Subject: RE: [PATCH v2] hv/hv_kvp_daemon: Enable debug logs for hv_kvp_daemon
> From: Shradha Gupta <shradhagupta@...ux.microsoft.com>
> Sent: Monday, March 31, 2025 9:06 PM
> > > +static void convert_tm_to_string(char *tm_str, size_t tm_str_size)
> > > +{
> > > + struct tm tm;
> > > + time_t t;
> > > +
> > > + time(&t);
> > > + gmtime_r(&t, &tm);
> > > + strftime(tm_str, tm_str_size, "%Y-%m-%dT%H:%M:%S", &tm);
> > > +}
> >
> > Now the function is unnecessary since v2 uses syslog(), which already
> > prefixes every message with a timestamp.
>
> Hi Dexuan,
> I have deliberately kept this timestamp in the raw message so that
> if/whenever they are redirected to other file, irrespective of the
> configuration of the syslog we have valid timestamp for debugging
A message produced by syslog() is always prefixed with a timestamp,
and IMO can't be redirected. By "redirected to other file", I guess
you mean systemd's options StandardOutput= and StandardError=
for a service, but those are stdout/err, not syslog().
> > > +static void kvp_dump_initial_pools(int pool)
> > > + [...]
> > > + for (i = 0; i < kvp_file_info[pool].num_records; i++)
> > > + syslog(LOG_DEBUG, "[%s]: pool: %d, %d/%d key=%s
> > > val=%s\n",
> > > + tm_str, pool, i, kvp_file_info[pool].num_records,
> >
> > Can you change the 'i' to 'i+1'? This makes the messages a little more
> > natural to users who are not programmers :-)
> sure, but I am just worried that might cause confusion when someone
> tried to co-relate it with the actual kv_pool_{i} contents that start
> with 0.
IMO these messages are mostly for admins, who would feel more
natural when seeing N/N as the last element, compared with N-1/N.
Thanks,
Dexuan
Powered by blists - more mailing lists