From 40dfd90a9f29ea56a871449172f809c4ae3cd4f6 Mon Sep 17 00:00:00 2001 From: Michael Meffie Date: Fri, 6 Feb 2015 11:33:48 -0500 Subject: [PATCH] externalize log rotation 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 Tested-by: BuildBot --- doc/man-pages/pod5/BackupLog.pod | 4 +-- doc/man-pages/pod5/BosLog.pod | 4 +-- doc/man-pages/pod5/FileLog.pod | 5 +--- doc/man-pages/pod5/VLLog.pod | 4 +-- doc/man-pages/pod5/VolserLog.pod | 4 +-- doc/man-pages/pod8/bosserver.pod | 7 +++++ .../pod8/fragments/dafileserver-synopsis.pod | 1 + .../pod8/fragments/fileserver-options.pod | 6 ++++ .../pod8/fragments/fileserver-synopsis.pod | 1 + .../pod8/fragments/volserver-options.pod | 6 ++++ .../pod8/fragments/volserver-synopsis.pod | 1 + doc/man-pages/pod8/ptserver.pod | 7 +++++ doc/man-pages/pod8/vlserver.pod | 7 +++++ src/bozo/bosserver.c | 7 ++++- src/budb/server.c | 12 ++++++-- src/ptserver/ptserver.c | 16 +++++++--- src/viced/viced.c | 29 ++++++++++++++----- src/vlserver/vlserver.c | 16 +++++++--- src/vol/salvaged.c | 18 ++++++++---- src/volser/volmain.c | 16 +++++++--- 20 files changed, 127 insertions(+), 44 deletions(-) diff --git a/doc/man-pages/pod5/BackupLog.pod b/doc/man-pages/pod5/BackupLog.pod index 3905d11ed..c8b1d360c 100644 --- a/doc/man-pages/pod5/BackupLog.pod +++ b/doc/man-pages/pod5/BackupLog.pod @@ -10,9 +10,7 @@ conditions it encounters. If the F file does not already exist in the F 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, overwriting the existing -F file if it exists. +writes initial start-up messages to it. The file is in ASCII format. Administrators listed in the F file can use the B command to display diff --git a/doc/man-pages/pod5/BosLog.pod b/doc/man-pages/pod5/BosLog.pod index 419596152..93f839b80 100644 --- a/doc/man-pages/pod5/BosLog.pod +++ b/doc/man-pages/pod5/BosLog.pod @@ -10,9 +10,7 @@ error conditions it encounters. If the F file does not already exist in the F 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, overwriting the existing -F file if it exists. +writes initial start-up messages to it. The file is in ASCII format. Administrators listed in the F file can use the B command to display diff --git a/doc/man-pages/pod5/FileLog.pod b/doc/man-pages/pod5/FileLog.pod index 2e381baca..726578b83 100644 --- a/doc/man-pages/pod5/FileLog.pod +++ b/doc/man-pages/pod5/FileLog.pod @@ -10,10 +10,7 @@ encounters. If the F file does not already exist in the F 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, overwriting the existing -F 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 file can use the B command to display diff --git a/doc/man-pages/pod5/VLLog.pod b/doc/man-pages/pod5/VLLog.pod index 0db9a67a3..77d6b064a 100644 --- a/doc/man-pages/pod5/VLLog.pod +++ b/doc/man-pages/pod5/VLLog.pod @@ -10,9 +10,7 @@ error conditions it encounters. If the F file does not already exist in the F 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, -overwriting the existing F 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 file can use the B command to display diff --git a/doc/man-pages/pod5/VolserLog.pod b/doc/man-pages/pod5/VolserLog.pod index 882e26b43..07326f455 100644 --- a/doc/man-pages/pod5/VolserLog.pod +++ b/doc/man-pages/pod5/VolserLog.pod @@ -10,9 +10,7 @@ conditions it encounters. If the VolserLog file does not already exist in the F 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, overwriting the existing -F file if it exists. +writes initial start-up messages to it. The file is in ASCII format. Administrators listed in the F file can use the B command to display diff --git a/doc/man-pages/pod8/bosserver.pod b/doc/man-pages/pod8/bosserver.pod index 222ef63b4..c865e0ba3 100644 --- a/doc/man-pages/pod8/bosserver.pod +++ b/doc/man-pages/pod8/bosserver.pod @@ -20,6 +20,7 @@ B S<<< [B<-rxmaxmtu> >] >>> S<<< [B<-rxbind>] >>> S<<< [B<-syslog>[=>]>] >>> + S<<< [B<-transarc-logs>] >>> S<<< [B<-pidfiles>[=>]] >>> 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 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 to F when the bos server is +restarted. This option is provided for compatibility with older versions. + =item B<-pidfiles>[=>] Create a one-line file containing the process id (pid) for each non-cron diff --git a/doc/man-pages/pod8/fragments/dafileserver-synopsis.pod b/doc/man-pages/pod8/fragments/dafileserver-synopsis.pod index 5a3bdc671..91a1550f1 100644 --- a/doc/man-pages/pod8/fragments/dafileserver-synopsis.pod +++ b/doc/man-pages/pod8/fragments/dafileserver-synopsis.pod @@ -37,6 +37,7 @@ B S<<< [B<-enable_process_stats>] >>> S<<< [B<-syslog> [>]] >>> S<<< [B<-mrafslogs>] >>> + S<<< [B<-transarc-logs>] >>> S<<< [B<-saneacls>] >>> S<<< [B<-help>] >>> S<<< [B<-vhandle-setaside> >] >>> diff --git a/doc/man-pages/pod8/fragments/fileserver-options.pod b/doc/man-pages/pod8/fragments/fileserver-options.pod index 67b754e56..a73965cbc 100644 --- a/doc/man-pages/pod8/fragments/fileserver-options.pod +++ b/doc/man-pages/pod8/fragments/fileserver-options.pod @@ -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 to F 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 diff --git a/doc/man-pages/pod8/fragments/fileserver-synopsis.pod b/doc/man-pages/pod8/fragments/fileserver-synopsis.pod index e6210a580..98d346b05 100644 --- a/doc/man-pages/pod8/fragments/fileserver-synopsis.pod +++ b/doc/man-pages/pod8/fragments/fileserver-synopsis.pod @@ -37,6 +37,7 @@ B S<<< [B<-enable_process_stats>] >>> S<<< [B<-syslog> [>]] >>> S<<< [B<-mrafslogs>] >>> + S<<< [B<-transarc-logs>] >>> S<<< [B<-saneacls>] >>> S<<< [B<-help>] >>> S<<< [B<-vhandle-setaside> >] >>> diff --git a/doc/man-pages/pod8/fragments/volserver-options.pod b/doc/man-pages/pod8/fragments/volserver-options.pod index 49e43c51a..740430e1c 100644 --- a/doc/man-pages/pod8/fragments/volserver-options.pod +++ b/doc/man-pages/pod8/fragments/volserver-options.pod @@ -14,6 +14,12 @@ successfully initiate a B command. The Volume Server also records any file removals that result from issuing the B command with the B<-f> flag. +=item B<-transarc-logs> + +Use Transarc style logging features. Rename the log file +F to F when the volume server is +restarted. This option is provided for compatibility with older versions. + =item B<-p> > Sets the number of server lightweight processes (LWPs) to run. Provide an diff --git a/doc/man-pages/pod8/fragments/volserver-synopsis.pod b/doc/man-pages/pod8/fragments/volserver-synopsis.pod index 82f67868d..f3c1dcab9 100644 --- a/doc/man-pages/pod8/fragments/volserver-synopsis.pod +++ b/doc/man-pages/pod8/fragments/volserver-synopsis.pod @@ -12,6 +12,7 @@ B [B<-rxmaxmtu> >] [B<-rxbind>] [B<-syslog>[=]] + [B<-transarc-logs>] [B<-sleep> /I>] [B<-restricted_query> (anyuser | admin)] [B<-help>] diff --git a/doc/man-pages/pod8/ptserver.pod b/doc/man-pages/pod8/ptserver.pod index d8272f093..6523280fb 100644 --- a/doc/man-pages/pod8/ptserver.pod +++ b/doc/man-pages/pod8/ptserver.pod @@ -18,6 +18,7 @@ ptserver S<<< [B<-database> | B<-db> >] >>> S<<< [B<-audit-interface> (file | sysvmq)] >>> S<<< [B<-syslog>[=>]] >>> S<<< [B<-logfile> >] >>> + [B<-transarc-logs>] S<<< [B<-config> >] >>> S<<< [B<-rxmaxmtu> >] >>> [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. +=item B<-transarc-logs> + +Use Transarc style logging features. Rename the log file +F to F when the PT Server is +restarted. This option is provided for compatibility with older versions. + =item B<-config> > Set the location of the configuration directory used to configure this diff --git a/doc/man-pages/pod8/vlserver.pod b/doc/man-pages/pod8/vlserver.pod index df8628149..c74b8bd83 100644 --- a/doc/man-pages/pod8/vlserver.pod +++ b/doc/man-pages/pod8/vlserver.pod @@ -16,6 +16,7 @@ vlserver [B<-noauth>] [B<-smallmem>] [B<-allow-dotted-principals>] S<<< [B<-database> | B<-db> >] >>> S<<< [B<-logfile> >] >>> + [B<-transarc-logs>] S<<< [B<-config> >] >>> S<<< [B<-syslog>[=>]>] >>> [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. +=item B<-transarc-logs> + +Use Transarc style logging features. Rename the log file +F to F when the VL Server is +restarted. This option is provided for compatibility with older versions. + =item B<-database> | B<-db> > Set the location of the database used by this program. This option is diff --git a/src/bozo/bosserver.c b/src/bozo/bosserver.c index f3be7aa6d..ddaae5df3 100644 --- a/src/bozo/bosserver.c +++ b/src/bozo/bosserver.c @@ -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=] \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"); diff --git a/src/budb/server.c b/src/budb/server.c index 5ba95d18a..3a8091845 100644 --- a/src/budb/server.c +++ b/src/budb/server.c @@ -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); diff --git a/src/ptserver/ptserver.c b/src/ptserver/ptserver.c index 9dfd7c194..2ab437de6 100644 --- a/src/ptserver/ptserver.c +++ b/src/ptserver/ptserver.c @@ -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 diff --git a/src/viced/viced.c b/src/viced/viced.c index 03bf03220..2dbac807b 100644 --- a/src/viced/viced.c +++ b/src/viced/viced.c @@ -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); diff --git a/src/vlserver/vlserver.c b/src/vlserver/vlserver.c index 9137deb73..22b29f383 100644 --- a/src/vlserver/vlserver.c +++ b/src/vlserver/vlserver.c @@ -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 diff --git a/src/vol/salvaged.c b/src/vol/salvaged.c index 8edf1b31f..6e4c87a0f 100644 --- a/src/vol/salvaged.c +++ b/src/vol/salvaged.c @@ -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 */ diff --git a/src/volser/volmain.c b/src/volser/volmain.c index b70f6434f..db976aa8a 100644 --- a/src/volser/volmain.c +++ b/src/volser/volmain.c @@ -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 -- 2.39.5