diff --git a/src/config/load.c b/src/config/load.c index 76a4e4f68..616d53e0c 100644 --- a/src/config/load.c +++ b/src/config/load.c @@ -240,10 +240,33 @@ Attempt to set the log file and turn file logging off if the file cannot be open the file again and error out. ***********************************************************************************************************************************/ void -cfgLoadLogFile(const String *logFile) +cfgLoadLogFile(void) { - if (!logFileSet(strPtr(logFile))) - cfgOptionSet(cfgOptLogLevelFile, cfgSourceParam, varNewStrZ("off")); + if (cfgLogFile() && !cfgCommandHelp()) + { + MEM_CONTEXT_TEMP_BEGIN() + { + // Construct log filename prefix + String *logFile = strNewFmt( + "%s/%s-", strPtr(cfgOptionStr(cfgOptLogPath)), + cfgOptionTest(cfgOptStanza) ? strPtr(cfgOptionStr(cfgOptStanza)): "all"); + + // If local or remote command add command name and process id + if (cfgCommand() == cfgCmdLocal || cfgCommand() == cfgCmdRemote) + { + strCatFmt( + logFile, "%s-%s-%03u.log", strPtr(cfgOptionStr(cfgOptCommand)), cfgCommandName(cfgCommand()), + cfgOptionUInt(cfgOptProcess)); + } + // Else add command name + else + strCatFmt(logFile, "%s.log", cfgCommandName(cfgCommand())); + + if (!logFileSet(strPtr(logFile))) + cfgOptionSet(cfgOptLogLevelFile, cfgSourceParam, varNewStrZ("off")); + } + MEM_CONTEXT_TEMP_END(); + } } /*********************************************************************************************************************************** @@ -277,27 +300,7 @@ cfgLoad(unsigned int argListSize, const char *argList[]) ioBufferSizeSet(cfgOptionUInt(cfgOptBufferSize)); // Open the log file if this command logs to a file - if (cfgLogFile() && !cfgCommandHelp()) - { - // Construct log filename prefix - String *logFile = strNewFmt( - "%s/%s-", strPtr(cfgOptionStr(cfgOptLogPath)), - cfgOptionTest(cfgOptStanza) ? strPtr(cfgOptionStr(cfgOptStanza)): "all"); - - // If local or remote command add command name and process id - if (cfgCommand() == cfgCmdLocal || cfgCommand() == cfgCmdRemote) - { - strCatFmt( - logFile, "%s-%s-%03u.log", strPtr(cfgOptionStr(cfgOptCommand)), cfgCommandName(cfgCommand()), - cfgOptionUInt(cfgOptProcess)); - } - // Else add command name - else - strCatFmt(logFile, "%s.log", cfgCommandName(cfgCommand())); - - // Set the log file name - cfgLoadLogFile(logFile); - } + cfgLoadLogFile(); // Begin the command cmdBegin(true); diff --git a/src/config/load.h b/src/config/load.h index 5fe2d5b2c..20ef1eea0 100644 --- a/src/config/load.h +++ b/src/config/load.h @@ -13,7 +13,7 @@ Functions ***********************************************************************************************************************************/ void cfgLoad(unsigned int argListSize, const char *argList[]); void cfgLoadLogSetting(void); -void cfgLoadLogFile(const String *logFile); +void cfgLoadLogFile(void); void cfgLoadUpdateOption(void); #endif diff --git a/src/main.c b/src/main.c index 9798fe62d..f63887920 100644 --- a/src/main.c +++ b/src/main.c @@ -115,7 +115,8 @@ main(int argListSize, const char *argList[]) // Switch to expire command cmdEnd(0, NULL); cfgCommandSet(cfgCmdExpire); - cmdBegin(false); + cfgLoadLogFile(); + cmdBegin(true); // Run expire perlExec(); diff --git a/test/expect/mock-all-001.log b/test/expect/mock-all-001.log index 3d06848d0..876a956fd 100644 --- a/test/expect/mock-all-001.log +++ b/test/expect/mock-all-001.log @@ -117,7 +117,7 @@ P01 INFO: backup file [TEST_PATH]/db-master/db/base/special-!_.*'()&!@;:+,? (0 P00 INFO: full backup size = 192KB P00 INFO: new backup label = [BACKUP-FULL-1] P00 INFO: backup command end: completed successfully -P00 INFO: expire command begin +P00 INFO: expire command begin [BACKREST-VERSION]: --buffer-size=16384 --checksum-page --no-compress --compress-level=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --exclude=postgresql.auto.conf --exclude=pg_log/ --exclude=pg_log2 --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log --log-subprocess --no-log-timestamp --manifest-save-threshold=3 --no-online --pg1-path=[TEST_PATH]/db-master/db/base --process-max=1 --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-master/repo --repo1-type=cifs --stanza=db --start-fast --type=full P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired P00 INFO: expire command end: completed successfully @@ -378,7 +378,7 @@ P01 INFO: backup file [TEST_PATH]/db-master/db/base/special-!_.*'()&!@;:+,? (0 P00 INFO: full backup size = 192KB P00 INFO: new backup label = [BACKUP-FULL-2] P00 INFO: backup command end: completed successfully -P00 INFO: expire command begin +P00 INFO: expire command begin [BACKREST-VERSION]: --checksum-page --no-compress --compress-level=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --delta --exclude=postgresql.auto.conf --exclude=pg_log/ --exclude=pg_log2 --force --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log --log-subprocess --no-log-timestamp --no-online --pg1-path=[TEST_PATH]/db-master/db/base --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast --test --test-delay=0.2 --test-point=backup-resume=y --type=full P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired P00 INFO: expire command end: completed successfully @@ -1024,7 +1024,7 @@ P00 WARN: page misalignment in file [TEST_PATH]/db-master/db/base/pg_tblspc/1/ P00 INFO: incr backup size = 22B P00 INFO: new backup label = [BACKUP-INCR-1] P00 INFO: backup command end: completed successfully -P00 INFO: expire command begin +P00 INFO: expire command begin [BACKREST-VERSION]: --no-compress --compress-level=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --exclude=postgresql.auto.conf --exclude=pg_log/ --exclude=pg_log2 --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log --log-subprocess --no-log-timestamp --no-online --pg1-path=[TEST_PATH]/db-master/db/base --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast --test P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired P00 INFO: expire command end: completed successfully @@ -1219,7 +1219,7 @@ P00 WARN: page misalignment in file [TEST_PATH]/db-master/db/base/pg_tblspc/1/ P00 INFO: incr backup size = 192KB P00 INFO: new backup label = [BACKUP-INCR-2] P00 INFO: backup command end: completed successfully -P00 INFO: expire command begin +P00 INFO: expire command begin [BACKREST-VERSION]: --no-compress --compress-level=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --delta --exclude=postgresql.auto.conf --exclude=pg_log/ --exclude=pg_log2 --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log --log-subprocess --no-log-timestamp --no-online --pg1-path=[TEST_PATH]/db-master/db/base --process-max=1 --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast --test --test-delay=0.2 --test-point=backup-resume=y P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired P00 INFO: expire command end: completed successfully @@ -1420,7 +1420,7 @@ P00 WARN: page misalignment in file [TEST_PATH]/db-master/db/base/pg_tblspc/1/ P00 INFO: diff backup size = 192KB P00 INFO: new backup label = [BACKUP-DIFF-1] P00 INFO: backup command end: completed successfully -P00 INFO: expire command begin +P00 INFO: expire command begin [BACKREST-VERSION]: --no-compress --compress-level=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --delta --exclude=postgresql.auto.conf --exclude=pg_log/ --exclude=pg_log2 --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log --log-subprocess --no-log-timestamp --no-online --pg1-path=[TEST_PATH]/db-master/db/base --process-max=1 --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast --test --test-delay=0.2 --test-point=backup-noresume=y --type=diff P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired P00 INFO: expire command end: completed successfully @@ -1616,7 +1616,7 @@ P00 WARN: page misalignment in file [TEST_PATH]/db-master/db/base/pg_tblspc/1/ P00 INFO: diff backup size = 192KB P00 INFO: new backup label = [BACKUP-DIFF-2] P00 INFO: backup command end: completed successfully -P00 INFO: expire command begin +P00 INFO: expire command begin [BACKREST-VERSION]: --no-compress --compress-level=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --delta --exclude=postgresql.auto.conf --exclude=pg_log/ --exclude=pg_log2 --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log --log-subprocess --no-log-timestamp --no-online --pg1-path=[TEST_PATH]/db-master/db/base --process-max=1 --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-master/repo --no-resume --stanza=db --start-fast --test --test-delay=0.2 --test-point=backup-noresume=y --type=diff P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired P00 INFO: expire command end: completed successfully @@ -1885,7 +1885,7 @@ P00 WARN: page misalignment in file [TEST_PATH]/db-master/db/base-2/base/base2 P00 INFO: incr backup size = 13B P00 INFO: new backup label = [BACKUP-INCR-3] P00 INFO: backup command end: completed successfully -P00 INFO: expire command begin +P00 INFO: expire command begin [BACKREST-VERSION]: --no-compress --compress-level=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --exclude=postgresql.auto.conf --exclude=pg_log/ --exclude=pg_log2 --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log --log-subprocess --no-log-timestamp --no-online --pg1-path=[TEST_PATH]/db-master/db/base-2 --process-max=1 --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired P00 INFO: expire command end: completed successfully @@ -2156,7 +2156,7 @@ P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base-2/pg_tbls P00 INFO: incr backup size = 176KB P00 INFO: new backup label = [BACKUP-INCR-4] P00 INFO: backup command end: completed successfully -P00 INFO: expire command begin +P00 INFO: expire command begin [BACKREST-VERSION]: --no-compress --compress-level=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --exclude=postgresql.auto.conf --exclude=pg_log/ --exclude=pg_log2 --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log --log-subprocess --no-log-timestamp --no-online --pg1-path=[TEST_PATH]/db-master/db/base-2 --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired P00 INFO: expire command end: completed successfully @@ -2354,7 +2354,7 @@ P00 WARN: page misalignment in file [TEST_PATH]/db-master/db/base-2/pg_tblspc/ P00 INFO: diff backup size = 176KB P00 INFO: new backup label = [BACKUP-DIFF-3] P00 INFO: backup command end: completed successfully -P00 INFO: expire command begin +P00 INFO: expire command begin [BACKREST-VERSION]: --no-compress --compress-level=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --delta --exclude=postgresql.auto.conf --exclude=pg_log/ --exclude=pg_log2 --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log --log-subprocess --no-log-timestamp --no-online --pg1-path=[TEST_PATH]/db-master/db/base-2 --process-max=1 --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast --type=diff P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired P00 INFO: expire command end: completed successfully @@ -2531,7 +2531,7 @@ P00 TEST: PgBaCkReStTeSt-MANIFEST-BUILD-PgBaCkReStTeSt P00 INFO: incr backup size = 0B P00 INFO: new backup label = [BACKUP-INCR-5] P00 INFO: backup command end: completed successfully -P00 INFO: expire command begin +P00 INFO: expire command begin [BACKREST-VERSION]: --compress --compress-level=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --exclude=postgresql.auto.conf --exclude=pg_log/ --exclude=pg_log2 --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log --log-subprocess --no-log-timestamp --no-online --pg1-path=[TEST_PATH]/db-master/db/base-2 --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast --test --test-delay=1 --test-point=manifest-build=y P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired P00 INFO: expire command end: completed successfully @@ -2731,7 +2731,7 @@ P00 WARN: page misalignment in file [TEST_PATH]/db-master/db/base-2/pg_tblspc/ P00 INFO: diff backup size = 176KB P00 INFO: new backup label = [BACKUP-DIFF-4] P00 INFO: backup command end: completed successfully -P00 INFO: expire command begin +P00 INFO: expire command begin [BACKREST-VERSION]: --compress --compress-level=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --delta --exclude=postgresql.auto.conf --exclude=pg_log/ --exclude=pg_log2 --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log --log-subprocess --no-log-timestamp --no-online --pg1-path=[TEST_PATH]/db-master/db/base-2 --process-max=1 --protocol-timeout=60 --repo1-hardlink --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast --test --test-delay=1 --test-point=manifest-build=y --type=diff P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired P00 INFO: expire command end: completed successfully @@ -2926,7 +2926,7 @@ P01 INFO: backup file [TEST_PATH]/db-master/db/base-2/pg_tblspc/2/[TS_PATH-1]/ P00 INFO: full backup size = 176KB P00 INFO: new backup label = [BACKUP-FULL-3] P00 INFO: backup command end: completed successfully -P00 INFO: expire command begin +P00 INFO: expire command begin [BACKREST-VERSION]: --compress --compress-level=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --exclude=postgresql.auto.conf --exclude=pg_log/ --exclude=pg_log2 --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log --log-subprocess --no-log-timestamp --no-online --pg1-path=[TEST_PATH]/db-master/db/base-2 --protocol-timeout=60 --repo1-hardlink --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast --type=full P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired P00 INFO: expire command end: completed successfully @@ -3483,7 +3483,7 @@ P00 DETAIL: hardlink pg_tblspc/2/[TS_PATH-1]/32768/tablespace2c.txt to [BACKUP-F P00 INFO: diff backup size = 9B P00 INFO: new backup label = [BACKUP-DIFF-5] P00 INFO: backup command end: completed successfully -P00 INFO: expire command begin +P00 INFO: expire command begin [BACKREST-VERSION]: --checksum-page --compress --compress-level=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --exclude=postgresql.auto.conf --exclude=pg_log/ --exclude=pg_log2 --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log --log-subprocess --no-log-timestamp --no-online --pg1-path=[TEST_PATH]/db-master/db/base-2 --protocol-timeout=60 --repo1-hardlink --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast --type=diff P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired P00 INFO: expire command end: completed successfully @@ -3976,7 +3976,7 @@ P01 INFO: backup file [TEST_PATH]/db-master/db/base-2/base/base/base2.txt (9B, P00 INFO: diff backup size = 9B P00 INFO: new backup label = [BACKUP-DIFF-6] P00 INFO: backup command end: completed successfully -P00 INFO: expire command begin +P00 INFO: expire command begin [BACKREST-VERSION]: --compress --compress-level=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --exclude=postgresql.auto.conf --exclude=pg_log/ --exclude=pg_log2 --lock-path=[TEST_PATH]/db-master/lock --log-level-console=info --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log --log-subprocess --no-log-timestamp --no-online --pg1-path=[TEST_PATH]/db-master/db/base-2/base --protocol-timeout=60 --repo1-hardlink --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast --type=diff P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired P00 INFO: expire command end: completed successfully @@ -4150,7 +4150,7 @@ P01 INFO: backup file [TEST_PATH]/db-master/db/base-2/base/base/base2.txt (9B, P00 INFO: diff backup size = 9B P00 INFO: new backup label = [BACKUP-DIFF-7] P00 INFO: backup command end: completed successfully -P00 INFO: expire command begin +P00 INFO: expire command begin [BACKREST-VERSION]: --backup-standby --compress --compress-level=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --exclude=postgresql.auto.conf --exclude=pg_log/ --exclude=pg_log2 --lock-path=[TEST_PATH]/db-master/lock --log-level-console=info --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log --log-subprocess --no-log-timestamp --no-online --pg1-path=[TEST_PATH]/db-master/db/base-2/base --protocol-timeout=60 --repo1-hardlink --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast --type=diff P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired P00 INFO: expire command end: completed successfully diff --git a/test/expect/mock-all-002.log b/test/expect/mock-all-002.log index 52b2505d4..cc1e7f490 100644 --- a/test/expect/mock-all-002.log +++ b/test/expect/mock-all-002.log @@ -3352,7 +3352,7 @@ P00 INFO: diff backup size = 9B P00 INFO: new backup label = [BACKUP-DIFF-6] P00 INFO: http statistics:[HTTP-STATISTICS] P00 INFO: backup command end: completed successfully -P00 INFO: expire command begin +P00 INFO: expire command begin [BACKREST-VERSION]: --compress --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --db-timeout=45 --lock-path=[TEST_PATH]/backup/lock --log-level-console=info --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/backup/log --log-subprocess --no-log-timestamp --no-online --pg1-host=db-master --pg1-host-cmd=[BACKREST-BIN] --pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf --pg1-host-user=[USER-2] --pg1-path=[TEST_PATH]/db-master/db/base-2/base --process-max=2 --protocol-timeout=60 --repo1-cipher-pass= --repo1-cipher-type=aes-256-cbc --repo1-path=/ --repo1-s3-bucket=pgbackrest-dev --repo1-s3-endpoint=s3.amazonaws.com --repo1-s3-key= --repo1-s3-key-secret= --repo1-s3-region=us-east-1 --no-repo1-s3-verify-tls --repo1-type=s3 --stanza=db --start-fast --type=diff P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired P00 INFO: http statistics:[HTTP-STATISTICS] P00 INFO: expire command end: completed successfully @@ -3561,7 +3561,7 @@ P00 INFO: diff backup size = 9B P00 INFO: new backup label = [BACKUP-DIFF-7] P00 INFO: http statistics:[HTTP-STATISTICS] P00 INFO: backup command end: completed successfully -P00 INFO: expire command begin +P00 INFO: expire command begin [BACKREST-VERSION]: --backup-standby --compress --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --db-timeout=45 --lock-path=[TEST_PATH]/backup/lock --log-level-console=info --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/backup/log --log-subprocess --no-log-timestamp --no-online --pg1-host=db-master --pg1-host-cmd=[BACKREST-BIN] --pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf --pg1-host-user=[USER-2] --pg1-path=[TEST_PATH]/db-master/db/base-2/base --process-max=2 --protocol-timeout=60 --repo1-cipher-pass= --repo1-cipher-type=aes-256-cbc --repo1-path=/ --repo1-s3-bucket=pgbackrest-dev --repo1-s3-endpoint=s3.amazonaws.com --repo1-s3-key= --repo1-s3-key-secret= --repo1-s3-region=us-east-1 --no-repo1-s3-verify-tls --repo1-type=s3 --stanza=db --start-fast --type=diff P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired P00 INFO: http statistics:[HTTP-STATISTICS] P00 INFO: expire command end: completed successfully diff --git a/test/expect/mock-stanza-001.log b/test/expect/mock-stanza-001.log index 9ac4fba96..ad2d9893c 100644 --- a/test/expect/mock-stanza-001.log +++ b/test/expect/mock-stanza-001.log @@ -534,7 +534,7 @@ P01 INFO: backup file [TEST_PATH]/db-master/db/base/pg_xlog/archive_status/000 P00 INFO: full backup size = 48MB P00 INFO: new backup label = [BACKUP-FULL-1] P00 INFO: backup command end: completed successfully -P00 INFO: expire command begin +P00 INFO: expire command begin [BACKREST-VERSION]: --compress-level=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log --log-subprocess --no-log-timestamp --no-online --pg1-path=[TEST_PATH]/db-master/db/base --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-master/repo --repo1-retention-full=2 --stanza=db --start-fast --type=full P00 ERROR: [029]: archive expiration cannot continue - archive and backup history lists do not match P00 INFO: expire command end: aborted with exception [029] @@ -713,7 +713,7 @@ P01 INFO: backup file [TEST_PATH]/db-master/db/base/pg_xlog/archive_status/000 P00 INFO: full backup size = 48MB P00 INFO: new backup label = [BACKUP-FULL-2] P00 INFO: backup command end: completed successfully -P00 INFO: expire command begin +P00 INFO: expire command begin [BACKREST-VERSION]: --compress-level=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log --log-subprocess --no-log-timestamp --no-online --pg1-path=[TEST_PATH]/db-master/db/base --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-master/repo --repo1-retention-full=2 --stanza=db --start-fast --type=diff P00 INFO: remove archive path: [TEST_PATH]/db-master/repo/archive/db/9.4-2 P00 INFO: expire command end: completed successfully diff --git a/test/expect/mock-stanza-002.log b/test/expect/mock-stanza-002.log index 0b1ced5dd..76eb512e4 100644 --- a/test/expect/mock-stanza-002.log +++ b/test/expect/mock-stanza-002.log @@ -326,7 +326,7 @@ P00 INFO: new backup label = [BACKUP-FULL-1] P00 DETAIL: tls statistics:[TLS-STATISTICS] P00 INFO: http statistics:[HTTP-STATISTICS] P00 INFO: backup command end: completed successfully -P00 INFO: expire command begin +P00 INFO: expire command begin [BACKREST-VERSION]: --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --db-timeout=45 --lock-path=[TEST_PATH]/backup/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/backup/log --log-subprocess --no-log-timestamp --no-online --pg1-host=db-master --pg1-host-cmd=[BACKREST-BIN] --pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf --pg1-host-user=[USER-1] --pg1-path=[TEST_PATH]/db-master/db/base --protocol-timeout=60 --repo1-cipher-pass= --repo1-cipher-type=aes-256-cbc --repo1-path=/ --repo1-retention-full=2 --repo1-s3-bucket=pgbackrest-dev --repo1-s3-endpoint=s3.amazonaws.com --repo1-s3-key= --repo1-s3-key-secret= --repo1-s3-region=us-east-1 --no-repo1-s3-verify-tls --repo1-type=s3 --stanza=db --start-fast --type=full P00 INFO: remove archive path: /archive/db/9.3-1 P00 INFO: full backup total < 2 - using oldest full backup for 9.4-2 archive retention P00 DETAIL: tls statistics:[TLS-STATISTICS] @@ -520,7 +520,7 @@ P00 INFO: new backup label = [BACKUP-FULL-2] P00 DETAIL: tls statistics:[TLS-STATISTICS] P00 INFO: http statistics:[HTTP-STATISTICS] P00 INFO: backup command end: completed successfully -P00 INFO: expire command begin +P00 INFO: expire command begin [BACKREST-VERSION]: --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --db-timeout=45 --lock-path=[TEST_PATH]/backup/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/backup/log --log-subprocess --no-log-timestamp --no-online --pg1-host=db-master --pg1-host-cmd=[BACKREST-BIN] --pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf --pg1-host-user=[USER-1] --pg1-path=[TEST_PATH]/db-master/db/base --protocol-timeout=60 --repo1-cipher-pass= --repo1-cipher-type=aes-256-cbc --repo1-path=/ --repo1-retention-full=2 --repo1-s3-bucket=pgbackrest-dev --repo1-s3-endpoint=s3.amazonaws.com --repo1-s3-key= --repo1-s3-key-secret= --repo1-s3-region=us-east-1 --no-repo1-s3-verify-tls --repo1-type=s3 --stanza=db --start-fast --type=diff P00 DETAIL: tls statistics:[TLS-STATISTICS] P00 INFO: http statistics:[HTTP-STATISTICS] P00 INFO: expire command end: completed successfully diff --git a/test/src/module/config/loadTest.c b/test/src/module/config/loadTest.c index d775ee912..66b55a5aa 100644 --- a/test/src/module/config/loadTest.c +++ b/test/src/module/config/loadTest.c @@ -320,12 +320,18 @@ testRun(void) // ***************************************************************************************************************************** if (testBegin("cfgLoadLogFile()")) { - cfgInit(); - cfgOptionValidSet(cfgOptLogLevelFile, true); - cfgOptionSet(cfgOptLogLevelFile, cfgSourceParam, varNewStrZ("detail")); + StringList *argList = strLstNew(); + strLstAdd(argList, strNew("pgbackrest")); + strLstAdd(argList, strNew("--stanza=db")); + strLstAdd(argList, strNew("--pg1-path=/path")); + strLstAdd(argList, strNew("--log-path=/bogus")); + strLstAdd(argList, strNew("--log-level-file=info")); + strLstAdd(argList, strNew("backup")); + TEST_RESULT_VOID(cfgLoad(strLstSize(argList), strLstPtr(argList)), "load config for backup"); + lockRelease(true); // On the error case is tested here, success is tested in cfgLoad() - TEST_RESULT_VOID(cfgLoadLogFile(strNew("/BOGUS")), "attempt to open bogus log file"); + TEST_RESULT_VOID(cfgLoadLogFile(), "attempt to open bogus log file"); TEST_RESULT_STR(strPtr(cfgOptionStr(cfgOptLogLevelFile)), "off", "log-level-file should now be off"); }