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:
parent
ca38251b10
commit
062ea3c418
@ -377,12 +377,11 @@ static void _init_logging(struct cmd_context *cmd)
|
|||||||
|
|
||||||
/* Syslog */
|
/* Syslog */
|
||||||
cmd->default_settings.syslog = find_config_tree_bool(cmd, log_syslog_CFG, NULL);
|
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();
|
fin_syslog();
|
||||||
|
|
||||||
if (cmd->default_settings.syslog > 1)
|
|
||||||
init_syslog(cmd->default_settings.syslog);
|
|
||||||
|
|
||||||
/* Debug level for log file output */
|
/* Debug level for log file output */
|
||||||
cmd->default_settings.debug = find_config_tree_int(cmd, log_level_CFG, NULL);
|
cmd->default_settings.debug = find_config_tree_int(cmd, log_level_CFG, NULL);
|
||||||
init_debug(cmd->default_settings.debug);
|
init_debug(cmd->default_settings.debug);
|
||||||
@ -1653,8 +1652,6 @@ struct cmd_context *create_toolcontext(unsigned is_clvmd,
|
|||||||
bindtextdomain(INTL_PACKAGE, LOCALEDIR);
|
bindtextdomain(INTL_PACKAGE, LOCALEDIR);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
init_syslog(DEFAULT_LOG_FACILITY);
|
|
||||||
|
|
||||||
if (!(cmd = zalloc(sizeof(*cmd)))) {
|
if (!(cmd = zalloc(sizeof(*cmd)))) {
|
||||||
log_error("Failed to allocate command context");
|
log_error("Failed to allocate command context");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -221,7 +221,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DEFAULT_COMMAND_LOG_REPORT 0
|
#define DEFAULT_COMMAND_LOG_REPORT 0
|
||||||
#define DEFAULT_SYSLOG 1
|
#define DEFAULT_SYSLOG 0
|
||||||
#define DEFAULT_VERBOSE 0
|
#define DEFAULT_VERBOSE 0
|
||||||
#define DEFAULT_SILENT 0
|
#define DEFAULT_SILENT 0
|
||||||
#define DEFAULT_LOGLEVEL 0
|
#define DEFAULT_LOGLEVEL 0
|
||||||
|
@ -312,8 +312,13 @@ void init_log_while_suspended(int log_while_suspended)
|
|||||||
_log_while_suspended = 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"))
|
if (getenv("LVM_SUPPRESS_SYSLOG"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ void init_abort_on_internal_errors(int fatal);
|
|||||||
void fin_log(void);
|
void fin_log(void);
|
||||||
void reset_log_duplicated(void);
|
void reset_log_duplicated(void);
|
||||||
|
|
||||||
void init_syslog(int facility);
|
void init_syslog(int enable, int facility);
|
||||||
void fin_syslog(void);
|
void fin_syslog(void);
|
||||||
|
|
||||||
void init_log_journal(uint32_t fields);
|
void init_log_journal(uint32_t fields);
|
||||||
|
Loading…
Reference in New Issue
Block a user