mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-03-03 14:52:21 +02:00
Implement issue #89: Make confess backtraces log-level dependent.
ASSERTs still dump stack traces to the console and file in all cases. ERRORs only dump stack traces to the file when the file log level is DEBUG or TRACE.
This commit is contained in:
parent
13e4eec629
commit
d321ef0b6d
@ -745,7 +745,7 @@ example: db-path=/data/db
|
||||
|
||||
* Better logging before pg_start_backup() to make it clear when the backup is waiting on a checkpoint. Suggested by Michael Renner.
|
||||
|
||||
* Various command behavior and help fixes. Reported by Michael Renner.
|
||||
* Various command behavior, help and logging fixes. Reported by Michael Renner.
|
||||
|
||||
* Fixed an issue in async archiving where archive-push was not properly returning 0 when archive-max-mb was reached and moved the async check after transfer to avoid having to remove the stop file twice. Also added unit tests for this case and improved error messages to make it clearer to the user what went wrong. Reported by Michael Renner.
|
||||
|
||||
|
@ -702,7 +702,7 @@ Run a <id>full</id> backup on the <id>db</id> stanza. <param>--type</param> can
|
||||
<text>Better logging before pg_start_backup() to make it clear when the backup is waiting on a checkpoint. Suggested by Michael Renner.</text>
|
||||
</release-feature>
|
||||
<release-feature>
|
||||
<text>Various command behavior and help fixes. Reported by Michael Renner.</text>
|
||||
<text>Various command behavior, help and logging fixes. Reported by Michael Renner.</text>
|
||||
</release-feature>
|
||||
<release-feature>
|
||||
<text>Fixed an issue in async archiving where archive-push was not properly returning 0 when archive-max-mb was reached and moved the async check after transfer to avoid having to remove the stop file twice. Also added unit tests for this case and improved error messages to make it clearer to the user what went wrong. Reported by Michael Renner.</text>
|
||||
|
@ -37,14 +37,17 @@ use constant
|
||||
ERROR_VERSION_NOT_SUPPORTED => 121,
|
||||
ERROR_PATH_CREATE => 122,
|
||||
ERROR_OPERATION_INVALID => 123,
|
||||
ERROR_HOST_CONNECT => 124
|
||||
ERROR_HOST_CONNECT => 124,
|
||||
|
||||
ERROR_UNKNOWN => 199
|
||||
};
|
||||
|
||||
our @EXPORT = qw(ERROR_ASSERT ERROR_CHECKSUM ERROR_CONFIG ERROR_FILE_INVALID ERROR_FORMAT ERROR_OPERATION_REQUIRED
|
||||
ERROR_OPTION_INVALID ERROR_OPTION_INVALID_VALUE ERROR_OPTION_INVALID_RANGE ERROR_OPTION_INVALID_PAIR
|
||||
ERROR_OPTION_DUPLICATE_KEY ERROR_OPTION_NEGATE ERROR_OPTION_REQUIRED ERROR_POSTMASTER_RUNNING ERROR_PROTOCOL
|
||||
ERROR_RESTORE_PATH_NOT_EMPTY ERROR_FILE_OPEN ERROR_FILE_READ ERROR_PARAM_REQUIRED ERROR_ARCHIVE_MISMATCH
|
||||
ERROR_ARCHIVE_DUPLICATE ERROR_VERSION_NOT_SUPPORTED ERROR_PATH_CREATE ERROR_OPERATION_INVALID ERROR_HOST_CONNECT);
|
||||
ERROR_ARCHIVE_DUPLICATE ERROR_VERSION_NOT_SUPPORTED ERROR_PATH_CREATE ERROR_OPERATION_INVALID ERROR_HOST_CONNECT
|
||||
ERROR_UNKNOWN);
|
||||
|
||||
####################################################################################################################################
|
||||
# CONSTRUCTOR
|
||||
|
@ -468,8 +468,13 @@ sub log
|
||||
$strMessageFormat =~ s/\n/\n /g;
|
||||
$strMessageFormat = ' ' . $strMessageFormat;
|
||||
}
|
||||
elsif ($strLevel eq ERROR && defined($iCode))
|
||||
elsif ($strLevel eq ERROR)
|
||||
{
|
||||
if (!defined($iCode))
|
||||
{
|
||||
$iCode = ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
$strMessageFormat =~ s/\n/\n /g;
|
||||
}
|
||||
|
||||
@ -509,7 +514,8 @@ sub log
|
||||
{
|
||||
print $hLogFile $strMessageFormat;
|
||||
|
||||
if ($strLevel eq ERROR || $strLevel eq ASSERT)
|
||||
if ($strLevel eq ASSERT ||
|
||||
($strLevel eq ERROR && ($strLogLevelFile eq DEBUG || $strLogLevelFile eq TRACE)))
|
||||
{
|
||||
my $strStackTrace = longmess() . "\n";
|
||||
$strStackTrace =~ s/\n/\n /g;
|
||||
|
Loading…
x
Reference in New Issue
Block a user