1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-11-06 08:49:29 +02:00

Fixed issue #97: Interleaved log lines during parallel operations.

This commit is contained in:
David Steele
2015-06-02 09:42:56 -04:00
parent 7e06e53a69
commit af98f164cd
3 changed files with 10 additions and 14 deletions

View File

@@ -739,7 +739,7 @@ example: db-path=/data/db
### v0.75: IN DEVELOPMENT - OTTAWA MILESTONE
*
* Logging now uses unbuffered output. This should make log files that are being written by multiple threads less chaotic. Suggested by Michael Renner.
### v0.70: Stability improvements for archiving, improved logging and help

View File

@@ -692,7 +692,7 @@ Run a <id>full</id> backup on the <id>db</id> stanza. <param>--type</param> can
<release-version version="0.75" title="IN DEVELOPMENT - OTTAWA MILESTONE">
<release-feature-bullet-list>
<release-feature>
<text></text>
<text>Logging now uses unbuffered output. This should make log files that are being written by multiple threads less chaotic. Suggested by Michael Renner.</text>
</release-feature>
</release-feature-bullet-list>
</release-version>

View File

@@ -339,10 +339,10 @@ sub log_file_set
if ($bExists)
{
print $hLogFile "\n";
syswrite($hLogFile, "\n");
}
print $hLogFile "-------------------PROCESS START-------------------\n";
syswrite($hLogFile, "-------------------PROCESS START-------------------\n");
}
####################################################################################################################################
@@ -491,17 +491,13 @@ sub log
{
if (!$bSuppressLog)
{
print $strMessageFormat;
syswrite(*STDOUT, $strMessageFormat);
}
if ($bTest && $strLevel eq TEST)
# If in test mode and this is a test messsage then delay so the calling process has time to read the message
if ($bTest && $strLevel eq TEST && $fTestDelay > 0)
{
*STDOUT->flush();
if ($fTestDelay > 0)
{
hsleep($fTestDelay);
}
hsleep($fTestDelay);
}
}
@@ -512,7 +508,7 @@ sub log
{
if (!$bSuppressLog)
{
print $hLogFile $strMessageFormat;
syswrite($hLogFile, $strMessageFormat);
if ($strLevel eq ASSERT ||
($strLevel eq ERROR && ($strLogLevelFile eq DEBUG || $strLogLevelFile eq TRACE)))
@@ -520,7 +516,7 @@ sub log
my $strStackTrace = longmess() . "\n";
$strStackTrace =~ s/\n/\n /g;
print $hLogFile $strStackTrace;
syswrite($hLogFile, $strStackTrace);
}
}
}