mirror of
https://passt.top/passt
synced 2025-06-11 18:15:34 +02:00
log, passt: Always print to stderr before initialisation is complete
After commit15001b39ef
("conf: set the log level much earlier"), we had a phase during initialisation when messages wouldn't be printed to standard error anymore. Commitf67238aa86
("passt, log: Call __openlog() earlier, log to stderr until we detach") fixed that, but only for the case where no log files are given. If a log file is configured, vlogmsg() will not call passt_vsyslog(), but during initialisation, LOG_PERROR is set, so to avoid duplicated prints (which would result from passt_vsyslog() printing to stderr), we don't call fprintf() from vlogmsg() either. This is getting a bit too complicated. Instead of abusing LOG_PERROR, define an internal logging flag that clearly represents that we're not done with the initialisation phase yet. If this flag is not set, make sure we always print to stderr, if the log mask matches. Reported-by: Yalan Zhang <yalzhang@redhat.com> Signed-off-by: Stefano Brivio <sbrivio@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
8c2f24a560
commit
afd9cdc9bb
3 changed files with 14 additions and 15 deletions
1
log.h
1
log.h
|
@ -30,6 +30,7 @@ void logmsg(int pri, const char *format, ...)
|
|||
|
||||
extern int log_trace;
|
||||
extern bool log_conf_parsed;
|
||||
extern bool log_runtime;
|
||||
|
||||
void trace_init(int enable);
|
||||
#define trace(...) \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue