Wed, Nov 06, 2019 at 10:48:49AM CET, liuhangbin@gmail.com wrote:
Hi Jiri,
I'm not sure if I should split the patch or just post one directly. Please tell me if you feel the commit message are repeated and want only one patch.
Recently some users reported that they start to see debug messages in their syslogs even with daemon_verbosity_level = LOG_INFO and without -g option.
Actually this issue is there at the begining, the user would see the debug messages if they run teamd with -d option. The reason that most users did not notice this is because they are using libteam via NetworkManager, and NetworkManager run libteam in frontend.
But after commit e47d5db53873 ("teamd: add an option to force log output to stdout, stderr or syslog"), NetworkManager will set TEAM_LOG_OUTPUT=syslog in the environment. At the same time libdaemon does not filter log levels if we use syslog(see function daemon_logv in libdaemon). Then all the users would see the debug messages suddenly and feels annoying.
And here is the quote for daemon_set_verbosity() from libdaemon/dlog.h """ Allows to decide which messages to output on standard output/error streams. All messages are logged to syslog and this setting does not influence that. """
Since we should not limit how our user(NM) used libteam. And libdaemon is intend to not filter logs if use syslog. We'd better filter the debug message ourselves, like via -g option. So I would prefer to move all teamd_log_dbg to teamd_log_dbgx. After that, the user could decide whether to enable debug or not by themselves with -g option.
So after this patchset, there is no user of teamd_log_dbg(), am I correct? I don't see you would remove it.
I would prefer to keep teamd_log_dbg() and only extend it with ctx arg, having it as: #define teamd_log_dbg(ctx, args...) teamd_log_dbgx(ctx, 1, ##args)
You can do it all in a single patch.
Sorry for the late reply :/