]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
externalize log rotation
authorMichael Meffie <mmeffie@sinenomine.net>
Fri, 6 Feb 2015 16:33:48 +0000 (11:33 -0500)
committerBenjamin Kaduk <kaduk@mit.edu>
Tue, 26 Apr 2016 23:34:59 +0000 (19:34 -0400)
Do not create new server log files when servers are restarted by
default.  External log rotation tools may be used to rotate the logs by
renaming log files and then signaling server processes to reopen
log files.

Add the -transarc-logs option to each server to provide backward
compatibility with the traditional Transarc-style logging.  When
-transarc-logs is given, log files are renamed to an ".old" file
(overwriting the existing ".old" file) and the previous the log file is
truncated.

Change-Id: I2eeb67e3db32b2f75fe685b68dab1159e62061e9
Reviewed-on: https://gerrit.openafs.org/11731
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
20 files changed:
doc/man-pages/pod5/BackupLog.pod
doc/man-pages/pod5/BosLog.pod
doc/man-pages/pod5/FileLog.pod
doc/man-pages/pod5/VLLog.pod
doc/man-pages/pod5/VolserLog.pod
doc/man-pages/pod8/bosserver.pod
doc/man-pages/pod8/fragments/dafileserver-synopsis.pod
doc/man-pages/pod8/fragments/fileserver-options.pod
doc/man-pages/pod8/fragments/fileserver-synopsis.pod
doc/man-pages/pod8/fragments/volserver-options.pod
doc/man-pages/pod8/fragments/volserver-synopsis.pod
doc/man-pages/pod8/ptserver.pod
doc/man-pages/pod8/vlserver.pod
src/bozo/bosserver.c
src/budb/server.c
src/ptserver/ptserver.c
src/viced/viced.c
src/vlserver/vlserver.c
src/vol/salvaged.c
src/volser/volmain.c

index 3905d11ed5ec4c88bfdffc68b46333813508df6f..c8b1d360cc3a098875ff9bd44d30dc3f6cf1ee36 100644 (file)
@@ -10,9 +10,7 @@ conditions it encounters.
 
 If the F<BackupLog> file does not already exist in the F</usr/afs/logs>
 directory when the Backup Server starts, the server process creates it and
-writes initial start-up messages to it. If there is an existing file, the
-Backup Server renames it to F<BackupLog.old>, overwriting the existing
-F<BackupLog.old> file if it exists.
+writes initial start-up messages to it.
 
 The file is in ASCII format. Administrators listed in the
 F</usr/afs/etc/UserList> file can use the B<bos getlog> command to display
index 419596152abd62ff2c0ba42f51d098f2999a1755..93f839b80f3163df368a4e611ccef414cbcca614 100644 (file)
@@ -10,9 +10,7 @@ error conditions it encounters.
 
 If the F<BosLog> file does not already exist in the F</usr/afs/logs>
 directory when the BOS Server starts, the server process creates it and
-writes initial start-up messages to it. If there is an existing file, the
-BOS server renames it to F<BosLog.old>, overwriting the existing
-F<BosLog.old> file if it exists.
+writes initial start-up messages to it.
 
 The file is in ASCII format. Administrators listed in the
 F</usr/afs/etc/UserList> file can use the B<bos getlog> command to display
index 2e381baca003cec8cc2b4c25606b845de687c758..726578b83475e0cd6c6ae84e539c2bcd94fac1a0 100644 (file)
@@ -10,10 +10,7 @@ encounters.
 
 If the F<FileLog> file does not already exist in the
 F</usr/afs/logs> directory when the File Server starts, the server
-process creates it and writes initial start-up messages to it. If there
-is an existing file, the File Server renames it to
-F<FileLog.old>, overwriting the existing
-F<FileLog.old> file if it exists.
+process creates it and writes initial start-up messages to it.
 
 The file is in ASCII format. Administrators listed in the
 F</usr/afs/etc/UserList> file can use the B<bos getlog> command to display
index 0db9a67a37cee1b573f446c5955a23d5e730c75f..77d6b064a010b757c702936eccdd4cb831284535 100644 (file)
@@ -10,9 +10,7 @@ error conditions it encounters.
 
 If the F<VLLog> file does not already exist in the
 F</usr/afs/logs> directory when the VL Server starts, the server
-process creates it and writes initial start-up messages to it. If there
-is an existing file, the VL Server renames it to F<VLLog.old>,
-overwriting the existing F<VLLog.old> file if it exists.
+process creates it and writes initial start-up messages to it.
 
 The file is in ASCII format. Administrators listed in the
 F</usr/afs/etc/UserList> file can use the B<bos getlog> command to display
index 882e26b4351027ff38013ceb522072c15ffff3b5..07326f4554b2d1e781293603982802a9ac1e1201 100644 (file)
@@ -10,9 +10,7 @@ conditions it encounters.
 
 If the VolserLog file does not already exist in the F</usr/afs/logs>
 directory when the Volume Server starts, the server process creates it and
-writes initial start-up messages to it. If there is an existing file, the
-Volume Server renames it to F<VolserLog.old>, overwriting the existing
-F<VolserLog.old> file if it exists.
+writes initial start-up messages to it.
 
 The file is in ASCII format. Administrators listed in the
 F</usr/afs/etc/UserList> file can use the B<bos getlog> command to display
index 222ef63b41c8f6fbc4d05a08da5813673b2fbbef..c865e0ba30926aeb39bfa65465d6ce5e7808cd58 100644 (file)
@@ -20,6 +20,7 @@ B<bosserver>
     S<<< [B<-rxmaxmtu> <I<bytes>>] >>>
     S<<< [B<-rxbind>] >>>
     S<<< [B<-syslog>[=<I<facility>>]>] >>>
+    S<<< [B<-transarc-logs>] >>>
     S<<< [B<-pidfiles>[=<I<path>>]] >>>
     S<<< [B<-nofork>] >>>
     S<<< [B<-help>] >>>
@@ -197,6 +198,12 @@ Specifies that logging output should go to syslog instead of the normal
 log file.  B<-syslog>=I<facility> can be used to specify to which facility
 the log message should be sent.
 
+=item B<-transarc-logs>
+
+Use Transarc style logging features. Rename the existing log file
+F</usr/afs/logs/BosLog> to F</usr/afs/logs/BosLog.old> when the bos server is
+restarted.  This option is provided for compatibility with older versions.
+
 =item B<-pidfiles>[=<I<path>>]
 
 Create a one-line file containing the process id (pid) for each non-cron
index 5a3bdc671686d5366c2813a9c89dfe8899707f6c..91a1550f1538c0bb4a2eb0307df07ff5a76f2cbf 100644 (file)
@@ -37,6 +37,7 @@ B<dafileserver>
     S<<< [B<-enable_process_stats>] >>>
     S<<< [B<-syslog> [<I< loglevel >>]] >>>
     S<<< [B<-mrafslogs>] >>>
+    S<<< [B<-transarc-logs>] >>>
     S<<< [B<-saneacls>] >>>
     S<<< [B<-help>] >>>
     S<<< [B<-vhandle-setaside> <I<fds reserved for non-cache io>>] >>>
index 67b754e564d88dbd190bf21a9376bd11a15622b9..a73965cbc5422539d9e169a4541b87547fdfc7ba 100644 (file)
@@ -265,6 +265,12 @@ default LOG_USER.
 
 Use MR-AFS (Multi-Resident) style logging.  This option is deprecated.
 
+=item B<-transarc-logs>
+
+Use Transarc style logging features. Rename the existing log file
+F</usr/afs/logs/FileLog> to F</usr/afs/logs/FileLog.old> when the fileserver is
+restarted.  This option is provided for compatibility with older versions.
+
 =item B<-saneacls>
 
 Offer the SANEACLS capability for the fileserver.  This option is
index e6210a580c3de8c6a76772e96ab21cc3474f0dda..98d346b05639c840099c54fe32a7f27b62d29252 100644 (file)
@@ -37,6 +37,7 @@ B<fileserver>
     S<<< [B<-enable_process_stats>] >>>
     S<<< [B<-syslog> [<I< loglevel >>]] >>>
     S<<< [B<-mrafslogs>] >>>
+    S<<< [B<-transarc-logs>] >>>
     S<<< [B<-saneacls>] >>>
     S<<< [B<-help>] >>>
     S<<< [B<-vhandle-setaside> <I<fds reserved for non-cache io>>] >>>
index 49e43c51a1c3185b067bbb1f9fc440a975aed7a5..740430e1ccd085aa440bbe4f9a5c5c435a33c426 100644 (file)
@@ -14,6 +14,12 @@ successfully initiate a B<vos> command. The Volume Server also records any
 file removals that result from issuing the B<vos release> command with the
 B<-f> flag.
 
+=item B<-transarc-logs>
+
+Use Transarc style logging features. Rename the log file
+F</usr/afs/logs/VolserLog> to F</usr/afs/logs/VolserLog.old> when the volume server is
+restarted.  This option is provided for compatibility with older versions.
+
 =item B<-p> <I<number of processes>>
 
 Sets the number of server lightweight processes (LWPs) to run.  Provide an
index 82f67868d71abfeba759952b55708c874dd4685b..f3c1dcab9c9c948c89c038fc38d311f441c0aad8 100644 (file)
@@ -12,6 +12,7 @@ B<volserver>
     [B<-rxmaxmtu> <I<bytes>>]
     [B<-rxbind>]
     [B<-syslog>[=<I<FACILITY>]]
+    [B<-transarc-logs>]
     [B<-sleep> <I<sleep time>/I<run time>>]
     [B<-restricted_query> (anyuser | admin)]
     [B<-help>]
index d8272f09321b63eec0fec1a25a0d546a016c78a1..6523280fb4a9d2938e55863a02e758fcb1a2ef20 100644 (file)
@@ -18,6 +18,7 @@ ptserver S<<< [B<-database> | B<-db> <I<db path>>] >>>
     S<<< [B<-audit-interface> (file | sysvmq)] >>>
     S<<< [B<-syslog>[=<I<FACILITY>>]] >>>
     S<<< [B<-logfile> <I<log file>>] >>>
+    [B<-transarc-logs>]
     S<<< [B<-config> <I<configuration path>>] >>>
     S<<< [B<-rxmaxmtu> <I<bytes>>] >>>
     [B<-help>]
@@ -163,6 +164,12 @@ Note that this option is intended for debugging and testing purposes.
 Changing the location of the log file from the command line may result
 in undesirable interactions with tools such as B<bos>.
 
+=item B<-transarc-logs>
+
+Use Transarc style logging features. Rename the log file
+F</usr/afs/logs/PtLog> to F</usr/afs/logs/PtLog.old> when the PT Server is
+restarted.  This option is provided for compatibility with older versions.
+
 =item B<-config> <I<configuration directory>>
 
 Set the location of the configuration directory used to configure this
index df86281494d7b4c86f057b20212661de3f54ba4b..c74b8bd8315b7efc9065a7855a315947d64f5eac 100644 (file)
@@ -16,6 +16,7 @@ vlserver [B<-noauth>] [B<-smallmem>]
     [B<-allow-dotted-principals>]
     S<<< [B<-database> | B<-db> <I<database path>>] >>>
     S<<< [B<-logfile> <I<log file>>] >>>
+    [B<-transarc-logs>]
     S<<< [B<-config> <I<configuration path>>] >>>
     S<<< [B<-syslog>[=<I<facility>>]>] >>>
     [B<-enable_peer_stats>] [B<-enable_process_stats>]
@@ -177,6 +178,12 @@ Note that this option is intended for debugging and testing purposes.
 Changing the location of the log file from the command line may result
 in undesirable interactions with tools such as B<bos>.
 
+=item B<-transarc-logs>
+
+Use Transarc style logging features. Rename the log file
+F</usr/afs/logs/VLLog> to F</usr/afs/logs/VLLog.old> when the VL Server is
+restarted.  This option is provided for compatibility with older versions.
+
 =item B<-database> | B<-db> <I<database path>>
 
 Set the location of the database used by this program. This option is
index f3be7aa6de16ef6f950af48da6850804acb40eba..ddaae5df33ae94a6ea8db22d7fe1f671714b3ada 100644 (file)
@@ -74,6 +74,7 @@ const char *DoPidFiles = NULL;
 #ifndef AFS_NT40_ENV
 int DoSyslogFacility = LOG_DAEMON;
 #endif
+int DoTransarcLogs = 0;
 static afs_int32 nextRestart;
 static afs_int32 nextDay;
 
@@ -995,6 +996,8 @@ main(int argc, char **argv, char **envp)
            DoPidFiles = (argv[code]+10);
        } else if (strncmp(argv[code], "-pidfiles", 9) == 0) {
            DoPidFiles = AFSDIR_LOCAL_DIR;
+       } else if (strcmp(argv[code], "-transarc-logs") == 0) {
+           DoTransarcLogs = 1;
        }
        else {
 
@@ -1010,6 +1013,7 @@ main(int argc, char **argv, char **envp)
                   "[-enable_peer_stats] [-enable_process_stats] "
                   "[-cores=<none|path>] \n"
                   "[-pidfiles[=path]] "
+                  "[-transarc-logs] "
                   "[-nofork] " "[-help]\n");
 #else
            printf("Usage: bosserver [-noauth] [-log] "
@@ -1047,7 +1051,8 @@ main(int argc, char **argv, char **envp)
 
     if (!DoSyslog) {
        /* Support logging to named pipes by not renaming. */
-       if ((lstat(AFSDIR_SERVER_BOZLOG_FILEPATH, &sb) == 0)
+       if (DoTransarcLogs
+           && (lstat(AFSDIR_SERVER_BOZLOG_FILEPATH, &sb) == 0)
            && !(S_ISFIFO(sb.st_mode))) {
            if (asprintf(&oldlog, "%s.old", AFSDIR_SERVER_BOZLOG_FILEPATH) < 0) {
                printf("bosserver: out of memory\n");
index 5ba95d18ad4283007bec50994d173225ea641a73..3a809184576466f0cd78f0847ae739927a16217b 100644 (file)
@@ -45,6 +45,7 @@ int parseServerList(struct cmd_item *);
 char lcell[MAXKTCREALMLEN];
 afs_uint32 myHost = 0;
 int helpOption;
+static struct logOptions logopts;
 
 /* server's global configuration information. This is exported to other
  * files/routines
@@ -173,6 +174,9 @@ initializeArgHandler(void)
 
     cmd_AddParm(cptr, "-audit-interface", CMD_SINGLE, CMD_OPTIONAL,
                "audit interface (file or sysvmq)");
+
+    cmd_AddParm(cptr, "-transarc-logs", CMD_FLAG, CMD_OPTIONAL,
+               "enable Transarc style logging");
 }
 
 int
@@ -250,6 +254,11 @@ argHandler(struct cmd_syndesc *as, void *arock)
            BUDB_EXIT(-1);
        }
     }
+    /* -transarc-logs */
+    if (as->parms[11].items != 0) {
+       logopts.lopt_rotateOnOpen = 1;
+       logopts.lopt_rotateStyle = logRotate_old;
+    }
 
     /* -auditlog */
     /* needs to be after -audit-interface, so we osi_audit_interface
@@ -371,7 +380,6 @@ main(int argc, char **argv)
     afs_int32 numClasses;
 
     extern int rx_stackSize;
-    struct logOptions logopts;
 
 #ifdef AFS_NT40_ENV
     /* initialize winsock */
@@ -404,8 +412,6 @@ main(int argc, char **argv)
     memset(&logopts, 0, sizeof(logopts));
     logopts.lopt_dest = logDest_file;
     logopts.lopt_filename = AFSDIR_SERVER_BUDBLOG_FILEPATH;
-    logopts.lopt_rotateOnOpen = 1;
-    logopts.lopt_rotateStyle = logRotate_old;
 
     osi_audit_init();
     osi_audit(BUDB_StartEvent, 0, AUD_END);
index 9dfd7c1944560e041c21a8ad13d9011b1fbc1b08..2ab437de652aec20f79bc122f08a24cf311aa1f8 100644 (file)
@@ -233,7 +233,8 @@ enum optionsList {
     OPT_process,
     OPT_rxbind,
     OPT_rxmaxmtu,
-    OPT_dotted
+    OPT_dotted,
+    OPT_transarc_logs
 };
 
 int
@@ -344,6 +345,8 @@ main(int argc, char **argv)
     cmd_AddParmAtOffset(opts, OPT_syslog, "-syslog", CMD_SINGLE_OR_FLAG, 
                        CMD_OPTIONAL, "log to syslog");
 #endif
+    cmd_AddParmAtOffset(opts, OPT_transarc_logs, "-transarc-logs", CMD_FLAG,
+                       CMD_OPTIONAL, "enable Transarc style logging");
 
     /* rx options */
     cmd_AddParmAtOffset(opts, OPT_peer, "-enable_peer_stats", CMD_FLAG,
@@ -419,6 +422,10 @@ main(int argc, char **argv)
            fprintf(stderr, "Invalid options: -syslog and -logfile are exclusive.");
            PT_EXIT(1);
        }
+       if (cmd_OptionPresent(opts, OPT_transarc_logs)) {
+           fprintf(stderr, "Invalid options: -syslog and -transarc-logs are exclusive.");
+           PT_EXIT(1);
+       }
        logopts.lopt_dest = logDest_syslog;
        logopts.lopt_facility = LOG_DAEMON;
        logopts.lopt_tag = "ptserver";
@@ -427,9 +434,10 @@ main(int argc, char **argv)
 #endif
     {
        logopts.lopt_dest = logDest_file;
-       logopts.lopt_rotateOnOpen = 1;
-       logopts.lopt_rotateStyle = logRotate_old;
-
+       if (cmd_OptionPresent(opts, OPT_transarc_logs)) {
+           logopts.lopt_rotateOnOpen = 1;
+           logopts.lopt_rotateStyle = logRotate_old;
+       }
        if (cmd_OptionPresent(opts, OPT_logfile))
            cmd_OptionAsString(opts, OPT_logfile, (char**)&logopts.lopt_filename);
        else
index 03bf03220dfb43cf25e6b554d3e55a4fa74d5d8e..2dbac807b8eef3a87ff252bdb1ba15f253d9e94b 100644 (file)
@@ -927,7 +927,8 @@ enum optionsList {
     OPT_udpsize,
     OPT_dotted,
     OPT_realm,
-    OPT_sync
+    OPT_sync,
+    OPT_transarc_logs
 };
 
 static int
@@ -1065,6 +1066,8 @@ ParseArgs(int argc, char *argv[])
                        "debug level");
     cmd_AddParmAtOffset(opts, OPT_mrafslogs, "-mrafslogs", CMD_FLAG,
                        CMD_OPTIONAL, "enable MRAFS style logging");
+    cmd_AddParmAtOffset(opts, OPT_transarc_logs, "-transarc-logs", CMD_FLAG,
+                       CMD_OPTIONAL, "enable Transarc style logging");
     cmd_AddParmAtOffset(opts, OPT_threads, "-p", CMD_SINGLE, CMD_OPTIONAL,
                        "number of threads");
 #ifdef HAVE_SYSLOG
@@ -1317,6 +1320,10 @@ ParseArgs(int argc, char *argv[])
            fprintf(stderr, "Invalid options: -syslog and -logfile are exclusive.\n");
            return -1;
        }
+       if (cmd_OptionPresent(opts, OPT_transarc_logs)) {
+           fprintf(stderr, "Invalid options: -syslog and -transarc-logs are exclusive.\n");
+           return -1;
+       }
        if (cmd_OptionPresent(opts, OPT_mrafslogs)) {
            fprintf(stderr, "Invalid options: -syslog and -mrafslogs are exclusive.\n");
            return -1;
@@ -1330,18 +1337,26 @@ ParseArgs(int argc, char *argv[])
 #endif
     {
        logopts.lopt_dest = logDest_file;
-       logopts.lopt_rotateOnOpen = 1;
-       logopts.lopt_rotateStyle = logRotate_old;
+
+       if (cmd_OptionPresent(opts, OPT_transarc_logs)) {
+           if (cmd_OptionPresent(opts, OPT_mrafslogs)) {
+               fprintf(stderr,
+                       "Invalid options: -transarc-logs and -mrafslogs are exclusive.\n");
+               return -1;
+           }
+           logopts.lopt_rotateOnOpen = 1;
+           logopts.lopt_rotateStyle = logRotate_old;
+       } else if (cmd_OptionPresent(opts, OPT_mrafslogs)) {
+           logopts.lopt_rotateOnOpen = 1;
+           logopts.lopt_rotateOnReset = 1;
+           logopts.lopt_rotateStyle = logRotate_timestamp;
+       }
 
        if (cmd_OptionPresent(opts, OPT_logfile))
            cmd_OptionAsString(opts, OPT_logfile, (char**)&logopts.lopt_filename);
        else
            logopts.lopt_filename = AFSDIR_SERVER_FILELOG_FILEPATH;
 
-       if (cmd_OptionPresent(opts, OPT_mrafslogs)) {
-           logopts.lopt_rotateOnReset = 1;
-           logopts.lopt_rotateStyle = logRotate_timestamp;
-       }
     }
     cmd_OptionAsInt(opts, OPT_debug, &logopts.lopt_logLevel);
 
index 9137deb731fab06a7c3e6f87f129c261b78bb821..22b29f38359a997f15f2e7d79c039b5a3d552c5b 100644 (file)
@@ -157,7 +157,8 @@ enum optionsList {
     OPT_rxmaxmtu,
     OPT_trace,
     OPT_dotted,
-    OPT_restricted_query
+    OPT_restricted_query,
+    OPT_transarc_logs
 };
 
 int
@@ -251,6 +252,8 @@ main(int argc, char **argv)
     cmd_AddParmAtOffset(opts, OPT_syslog, "-syslog", CMD_SINGLE_OR_FLAG,
                        CMD_OPTIONAL, "log to syslog");
 #endif
+    cmd_AddParmAtOffset(opts, OPT_transarc_logs, "-transarc-logs", CMD_FLAG,
+                       CMD_OPTIONAL, "enable Transarc style logging");
 
     /* rx options */
     cmd_AddParmAtOffset(opts, OPT_peer, "-enable_peer_stats", CMD_FLAG,
@@ -327,6 +330,10 @@ main(int argc, char **argv)
            fprintf(stderr, "Invalid options: -syslog and -logfile are exclusive.\n");
            return -1;
        }
+       if (cmd_OptionPresent(opts, OPT_transarc_logs)) {
+           fprintf(stderr, "Invalid options: -syslog and -transarc-logs are exclusive.\n");
+           return -1;
+       }
 
        logopts.lopt_dest = logDest_syslog;
        logopts.lopt_facility = LOG_DAEMON; /* default value */
@@ -336,9 +343,10 @@ main(int argc, char **argv)
 #endif
     {
        logopts.lopt_dest = logDest_file;
-       logopts.lopt_rotateOnOpen = 1;
-       logopts.lopt_rotateStyle = logRotate_old;
-
+       if (cmd_OptionPresent(opts, OPT_transarc_logs)) {
+           logopts.lopt_rotateOnOpen = 1;
+           logopts.lopt_rotateStyle = logRotate_old;
+       }
        if (cmd_OptionPresent(opts, OPT_logfile))
            cmd_OptionAsString(opts, OPT_logfile, (char**)&logopts.lopt_filename);
        else
index 8edf1b31f6d09037b1bff4302119315dea1467ce..6e4c87a0f8a8734d6f469bc722bce9b40e232e2b 100644 (file)
@@ -183,7 +183,8 @@ enum optionsList {
     OPT_syslog,
     OPT_syslogfacility,
     OPT_logfile,
-    OPT_client
+    OPT_client,
+    OPT_transarc_logs
 };
 
 static int
@@ -263,7 +264,10 @@ handleit(struct cmd_syndesc *opts, void *arock)
            fprintf(stderr, "Invalid options: -syslog and -logfile are exclusive.\n");
            return -1;
        }
-
+       if (cmd_OptionPresent(opts, OPT_transarc_logs)) {
+           fprintf(stderr, "Invalid options: -syslog and -transarc-logs are exclusive.\n");
+           return -1;
+       }
        logopts.lopt_dest = logDest_syslog;
        logopts.lopt_facility = LOG_DAEMON;
        logopts.lopt_tag = "salvageserver";
@@ -272,9 +276,10 @@ handleit(struct cmd_syndesc *opts, void *arock)
 #endif
     {
        logopts.lopt_dest = logDest_file;
-       logopts.lopt_rotateOnOpen = 1;
-       logopts.lopt_rotateStyle = logRotate_old;
-
+       if (cmd_OptionPresent(opts, OPT_transarc_logs)) {
+           logopts.lopt_rotateOnOpen = 1;
+           logopts.lopt_rotateStyle = logRotate_old;
+       }
        if (cmd_OptionPresent(opts, OPT_logfile))
            cmd_OptionAsString(opts, OPT_logfile, (char**)&logopts.lopt_filename);
        else
@@ -427,6 +432,9 @@ main(int argc, char **argv)
     cmd_AddParmAtOffset(ts, OPT_logfile, "-logfile", CMD_SINGLE, CMD_OPTIONAL,
            "Location of log file ");
 
+    cmd_AddParmAtOffset(ts, OPT_transarc_logs, "-transarc-logs", CMD_FLAG,
+                       CMD_OPTIONAL, "enable Transarc style logging");
+
     err = cmd_Dispatch(argc, argv);
     Exit(err);
     return 0; /* not reached */
index b70f6434f3f5401592e5b2e247474ee8dbad133a..db976aa8a6230b623aaedc4c88f3279d0dcfefe4 100644 (file)
@@ -241,7 +241,8 @@ enum optionsList {
 #endif
     OPT_logfile,
     OPT_config,
-    OPT_restricted_query
+    OPT_restricted_query,
+    OPT_transarc_logs
 };
 
 static int
@@ -289,6 +290,8 @@ ParseArgs(int argc, char **argv) {
     cmd_AddParmAtOffset(opts, OPT_syslog, "-syslog", CMD_SINGLE_OR_FLAG,
            CMD_OPTIONAL, "log to syslog");
 #endif
+    cmd_AddParmAtOffset(opts, OPT_transarc_logs, "-transarc-logs", CMD_FLAG,
+                       CMD_OPTIONAL, "enable Transarc style logging");
     cmd_AddParmAtOffset(opts, OPT_sync, "-sync",
            CMD_SINGLE, CMD_OPTIONAL, "always | onclose | never");
     cmd_AddParmAtOffset(opts, OPT_logfile, "-logfile", CMD_SINGLE,
@@ -324,6 +327,10 @@ ParseArgs(int argc, char **argv) {
            fprintf(stderr, "Invalid options: -syslog and -logfile are exclusive.\n");
            return -1;
        }
+       if (cmd_OptionPresent(opts, OPT_transarc_logs)) {
+           fprintf(stderr, "Invalid options: -syslog and -transarc-logs are exclusive.\n");
+           return -1;
+       }
        logopts.lopt_dest = logDest_syslog;
        logopts.lopt_facility = LOG_DAEMON;
        logopts.lopt_tag = "volserver";
@@ -332,9 +339,10 @@ ParseArgs(int argc, char **argv) {
 #endif
     {
        logopts.lopt_dest = logDest_file;
-       logopts.lopt_rotateOnOpen = 1;
-       logopts.lopt_rotateStyle = logRotate_old;
-
+       if (cmd_OptionPresent(opts, OPT_transarc_logs)) {
+           logopts.lopt_rotateOnOpen = 1;
+           logopts.lopt_rotateStyle = logRotate_old;
+       }
        if (cmd_OptionPresent(opts, OPT_logfile))
            cmd_OptionAsString(opts, OPT_logfile, (char**)&logopts.lopt_filename);
        else