1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

fix syslog setting

Just setting lvm.conf level=N should not send messages to
syslog (now the journal by default.)

Sending messages to syslog should require setting lvm.conf
log { syslog=1 level=N }.
This commit is contained in:
David Teigland 2021-10-11 17:08:05 -05:00
parent ca38251b10
commit 062ea3c418
4 changed files with 11 additions and 9 deletions

View File

@ -377,12 +377,11 @@ static void _init_logging(struct cmd_context *cmd)
/* Syslog */
cmd->default_settings.syslog = find_config_tree_bool(cmd, log_syslog_CFG, NULL);
if (cmd->default_settings.syslog != 1)
if (cmd->default_settings.syslog)
init_syslog(1, DEFAULT_LOG_FACILITY);
else
fin_syslog();
if (cmd->default_settings.syslog > 1)
init_syslog(cmd->default_settings.syslog);
/* Debug level for log file output */
cmd->default_settings.debug = find_config_tree_int(cmd, log_level_CFG, NULL);
init_debug(cmd->default_settings.debug);
@ -1653,8 +1652,6 @@ struct cmd_context *create_toolcontext(unsigned is_clvmd,
bindtextdomain(INTL_PACKAGE, LOCALEDIR);
#endif
init_syslog(DEFAULT_LOG_FACILITY);
if (!(cmd = zalloc(sizeof(*cmd)))) {
log_error("Failed to allocate command context");
return NULL;

View File

@ -221,7 +221,7 @@
#endif
#define DEFAULT_COMMAND_LOG_REPORT 0
#define DEFAULT_SYSLOG 1
#define DEFAULT_SYSLOG 0
#define DEFAULT_VERBOSE 0
#define DEFAULT_SILENT 0
#define DEFAULT_LOGLEVEL 0

View File

@ -312,8 +312,13 @@ void init_log_while_suspended(int log_while_suspended)
_log_while_suspended = log_while_suspended;
}
void init_syslog(int facility)
void init_syslog(int enable, int facility)
{
if (!enable) {
_syslog = 0;
return;
}
if (getenv("LVM_SUPPRESS_SYSLOG"))
return;

View File

@ -59,7 +59,7 @@ void init_abort_on_internal_errors(int fatal);
void fin_log(void);
void reset_log_duplicated(void);
void init_syslog(int facility);
void init_syslog(int enable, int facility);
void fin_syslog(void);
void init_log_journal(uint32_t fields);