You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-09-02 12:41:14 +03:00
Added the log-level-stderr option.
Controls whether console log messages are sent to stderr or stdout. By default this is set to warn which represents a change in behavior from previous versions, even though it may be more intuitive. Setting log-level-stderr=off will preserve the old behavior. Suggested by Sascha Biberhofer.
This commit is contained in:
@@ -280,6 +280,8 @@ use constant OPTION_LOG_LEVEL_CONSOLE => 'log-leve
|
||||
push @EXPORT, qw(OPTION_LOG_LEVEL_CONSOLE);
|
||||
use constant OPTION_LOG_LEVEL_FILE => 'log-level-file';
|
||||
push @EXPORT, qw(OPTION_LOG_LEVEL_FILE);
|
||||
use constant OPTION_LOG_LEVEL_STDERR => 'log-level-stderr';
|
||||
push @EXPORT, qw(OPTION_LOG_LEVEL_STDERR);
|
||||
|
||||
# ARCHIVE Section
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -469,6 +471,8 @@ use constant OPTION_DEFAULT_LOG_LEVEL_CONSOLE => lc(WARN);
|
||||
push @EXPORT, qw(OPTION_DEFAULT_LOG_LEVEL_CONSOLE);
|
||||
use constant OPTION_DEFAULT_LOG_LEVEL_FILE => lc(INFO);
|
||||
push @EXPORT, qw(OPTION_DEFAULT_LOG_LEVEL_FILE);
|
||||
use constant OPTION_DEFAULT_LOG_LEVEL_STDERR => lc(WARN);
|
||||
push @EXPORT, qw(OPTION_DEFAULT_LOG_LEVEL_STDERR);
|
||||
|
||||
# ARCHIVE SECTION
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -1290,6 +1294,35 @@ my %oOptionRule =
|
||||
}
|
||||
},
|
||||
|
||||
&OPTION_LOG_LEVEL_STDERR =>
|
||||
{
|
||||
&OPTION_RULE_SECTION => CONFIG_SECTION_GLOBAL,
|
||||
&OPTION_RULE_TYPE => OPTION_TYPE_STRING,
|
||||
&OPTION_RULE_DEFAULT => OPTION_DEFAULT_LOG_LEVEL_STDERR,
|
||||
&OPTION_RULE_ALLOW_LIST =>
|
||||
{
|
||||
lc(OFF) => true,
|
||||
lc(ERROR) => true,
|
||||
lc(WARN) => true,
|
||||
lc(INFO) => true,
|
||||
lc(DETAIL) => true,
|
||||
lc(DEBUG) => true,
|
||||
lc(TRACE) => true
|
||||
},
|
||||
&OPTION_RULE_COMMAND =>
|
||||
{
|
||||
&CMD_ARCHIVE_GET => true,
|
||||
&CMD_ARCHIVE_PUSH => true,
|
||||
&CMD_BACKUP => true,
|
||||
&CMD_CHECK => true,
|
||||
&CMD_EXPIRE => true,
|
||||
&CMD_INFO => true,
|
||||
&CMD_RESTORE => true,
|
||||
&CMD_START => true,
|
||||
&CMD_STOP => true
|
||||
}
|
||||
},
|
||||
|
||||
# ARCHIVE Section
|
||||
#-------------------------------------------------------------------------------------------------------------------------------
|
||||
&OPTION_ARCHIVE_ASYNC =>
|
||||
@@ -1926,7 +1959,8 @@ sub configLoad
|
||||
{
|
||||
logLevelSet(
|
||||
optionValid(OPTION_LOG_LEVEL_FILE) ? optionGet(OPTION_LOG_LEVEL_FILE) : OFF,
|
||||
optionValid(OPTION_LOG_LEVEL_CONSOLE) ? optionGet(OPTION_LOG_LEVEL_CONSOLE) : OFF);
|
||||
optionValid(OPTION_LOG_LEVEL_CONSOLE) ? optionGet(OPTION_LOG_LEVEL_CONSOLE) : OFF,
|
||||
optionValid(OPTION_LOG_LEVEL_STDERR) ? optionGet(OPTION_LOG_LEVEL_STDERR) : OFF);
|
||||
}
|
||||
|
||||
# Neutralize the umask to make the repository file/path modes more consistent
|
||||
|
@@ -445,6 +445,28 @@ my $oConfigHelpData =
|
||||
"* trace - Log trace (very verbose debugging), debug, info, warnings, and errors"
|
||||
},
|
||||
|
||||
# LOG-LEVEL-STDERR Option Help
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
'log-level-stderr' =>
|
||||
{
|
||||
section => 'log',
|
||||
summary =>
|
||||
"Level for stderr logging.",
|
||||
description =>
|
||||
"Specifies which log levels must will be output to stderr rather than stdout (specified by log-level-console). " .
|
||||
"The timestamp and process will not be output to stderr.\n" .
|
||||
"\n" .
|
||||
"The following log levels are supported:\n" .
|
||||
"\n" .
|
||||
"* off - No logging at all (not recommended)\n" .
|
||||
"* error - Log only errors\n" .
|
||||
"* warn - Log warnings and errors\n" .
|
||||
"* info - Log info, warnings, and errors\n" .
|
||||
"* detail - Log detail, info, warnings, and errors\n" .
|
||||
"* debug - Log debug, detail, info, warnings, and errors\n" .
|
||||
"* trace - Log trace (very verbose debugging), debug, info, warnings, and errors"
|
||||
},
|
||||
|
||||
# LOG-PATH Option Help
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
'log-path' =>
|
||||
@@ -767,6 +789,7 @@ my $oConfigHelpData =
|
||||
'lock-path' => 'section',
|
||||
'log-level-console' => 'section',
|
||||
'log-level-file' => 'section',
|
||||
'log-level-stderr' => 'section',
|
||||
'log-path' => 'section',
|
||||
'neutral-umask' => 'section',
|
||||
'protocol-timeout' => 'section',
|
||||
@@ -803,6 +826,7 @@ my $oConfigHelpData =
|
||||
'lock-path' => 'section',
|
||||
'log-level-console' => 'section',
|
||||
'log-level-file' => 'section',
|
||||
'log-level-stderr' => 'section',
|
||||
'log-path' => 'section',
|
||||
'neutral-umask' => 'section',
|
||||
'protocol-timeout' => 'section',
|
||||
@@ -867,6 +891,7 @@ my $oConfigHelpData =
|
||||
'lock-path' => 'section',
|
||||
'log-level-console' => 'section',
|
||||
'log-level-file' => 'section',
|
||||
'log-level-stderr' => 'section',
|
||||
'log-path' => 'section',
|
||||
'manifest-save-threshold' => 'section',
|
||||
'neutral-umask' => 'section',
|
||||
@@ -940,6 +965,7 @@ my $oConfigHelpData =
|
||||
'db-user' => 'section',
|
||||
'log-level-console' => 'section',
|
||||
'log-level-file' => 'section',
|
||||
'log-level-stderr' => 'section',
|
||||
'log-path' => 'section',
|
||||
'neutral-umask' => 'section',
|
||||
'online' => 'default',
|
||||
@@ -971,6 +997,7 @@ my $oConfigHelpData =
|
||||
'lock-path' => 'section',
|
||||
'log-level-console' => 'section',
|
||||
'log-level-file' => 'section',
|
||||
'log-level-stderr' => 'section',
|
||||
'log-path' => 'section',
|
||||
'repo-path' => 'section',
|
||||
'retention-archive' => 'section',
|
||||
@@ -1023,6 +1050,7 @@ my $oConfigHelpData =
|
||||
'lock-path' => 'section',
|
||||
'log-level-console' => 'section',
|
||||
'log-level-file' => 'section',
|
||||
'log-level-stderr' => 'section',
|
||||
'log-path' => 'section',
|
||||
|
||||
# OUTPUT Option Help
|
||||
@@ -1108,6 +1136,7 @@ my $oConfigHelpData =
|
||||
'lock-path' => 'section',
|
||||
'log-level-console' => 'section',
|
||||
'log-level-file' => 'section',
|
||||
'log-level-stderr' => 'section',
|
||||
'log-path' => 'section',
|
||||
'neutral-umask' => 'section',
|
||||
'process-max' => 'section',
|
||||
@@ -1227,6 +1256,7 @@ my $oConfigHelpData =
|
||||
'lock-path' => 'section',
|
||||
'log-level-console' => 'section',
|
||||
'log-level-file' => 'section',
|
||||
'log-level-stderr' => 'section',
|
||||
'log-path' => 'section',
|
||||
'repo-path' => 'section',
|
||||
'stanza' => 'default'
|
||||
@@ -1274,6 +1304,7 @@ my $oConfigHelpData =
|
||||
'lock-path' => 'section',
|
||||
'log-level-console' => 'section',
|
||||
'log-level-file' => 'section',
|
||||
'log-level-stderr' => 'section',
|
||||
'log-path' => 'section',
|
||||
'repo-path' => 'section',
|
||||
'stanza' => 'default'
|
||||
|
Reference in New Issue
Block a user