else if (strncmp (arg, "-enable_process_stats", alen) == 0) {
rx_enableProcessRPCStats();
}
+#ifndef AFS_NT40_ENV
+ else if (strncmp(arg, "-syslog", alen)==0) {
+ /* set syslog logging flag */
+ serverLogSyslog = 1;
+ }
+ else if (strncmp(arg, "-syslog=", MIN(8,alen))==0) {
+ serverLogSyslog = 1;
+ serverLogSyslogFacility = atoi(arg+8);
+ }
+#endif
else if (*arg == '-') {
usage:
/* hack in help flag support */
printf ("Usage: ptserver [-database <db path>] "
- "[-p <number of processes>] [-rebuildDB] "
+#ifndef AFS_NT40_ENV
+ "[-syslog[=FACILITY]] "
+#endif
+ "[-p <number of processes>] [-rebuild] "
/* "[-enable_peer_stats] [-enable_process_stats] " */
"[-help]\n");
fflush(stdout);
#include <stdio.h>
#include <stdarg.h>
extern int LogLevel;
+#ifndef AFS_NT40_ENV
+extern int serverLogSyslog;
+extern int serverLogSyslogFacility;
+#endif
extern void FSLog(const char *format, ...);
#define ViceLog(level, str) if ((level) <= LogLevel) (FSLog str)
#endif
#include <sys/param.h>
#include <sys/time.h>
+#include <syslog.h>
#endif
#include <afs/procmgmt.h> /* signal(), kill(), wait(), etc. */
#include <fcntl.h>
static int serverLogFD = -1;
+#ifndef AFS_NT40_ENV
+int serverLogSyslog = 0;
+int serverLogSyslogFacility = LOG_DAEMON;
+#endif
+
#include <stdarg.h>
int LogLevel;
int mrafsStyleLogs = 0;
int printLocks = 0;
static char ourName[MAXPATHLEN];
-void WriteLogBuffer(buf,len)
- char *buf;
- afs_uint32 len;
-{
- LOCK_SERVERLOG();
- if (serverLogFD > 0)
- write(serverLogFD, buf, len);
- UNLOCK_SERVERLOG();
-}
-
/* VARARGS1 */
void FSLog (const char *format, ...)
{
len = strlen(tbuffer);
LOCK_SERVERLOG();
- if (serverLogFD > 0)
- write(serverLogFD, tbuffer, len);
+#ifndef AFS_NT40_ENV
+ if ( serverLogSyslog ){
+ syslog(LOG_INFO, "%s", info);
+ } else
+#endif
+ if (serverLogFD > 0)
+ write(serverLogFD, tbuffer, len);
UNLOCK_SERVERLOG();
#if !defined(AFS_PTHREAD_ENV)
struct tm *TimeFields;
char FileName[MAXPATHLEN];
+ if ( serverLogSyslog ) {
+#ifndef AFS_NT40_ENV
+ openlog(NULL, LOG_PID, serverLogSyslogFacility);
+ return;
+#endif
+ }
+
if (mrafsStyleLogs) {
TM_GetTimeOfDay(&Start, 0);
TimeFields = localtime(&Start.tv_sec);
if (access(fileName, F_OK)==0)
return 0; /* exists, no need to reopen. */
+ if ( serverLogSyslog ) {
+ return 0;
+ }
+
#if defined(AFS_PTHREAD_ENV)
LOCK_SERVERLOG();
if (serverLogFD > 0)
if (!strcmp(argv[i], "-enable_process_stats")) {
rx_enableProcessRPCStats();
}
+#ifndef AFS_NT40_ENV
+ else
+ if (strcmp(argv[i], "-syslog")==0) {
+ /* set syslog logging flag */
+ serverLogSyslog = 1;
+ }
+ else
+ if (strncmp(argv[i], "-syslog=", 8)==0) {
+ serverLogSyslog = 1;
+ serverLogSyslogFacility = atoi(argv[i]+8);
+ }
+#endif
else {
return(-1);
}
rx_enablePeerRPCStats();
} else if (strcmp(argv[index], "-enable_process_stats") == 0) {
rx_enableProcessRPCStats();
+#ifndef AFS_NT40_ENV
+ } else if (strcmp(argv[index], "-syslog")==0) {
+ /* set syslog logging flag */
+ serverLogSyslog = 1;
+ } else if (strncmp(argv[index], "-syslog=", 8)==0) {
+ serverLogSyslog = 1;
+ serverLogSyslogFacility = atoi(argv[index]+8);
+#endif
} else {
/* support help flag */
printf("Usage: vlserver [-p <number of processes>] [-nojumbo] "
+#ifndef AFS_NT40_ENV
+ "[-syslog[=FACILITY]] "
+#endif
/*" [-enable_peer_stats] [-enable_process_stats] " */
"[-help]\n");
fflush(stdout);
else if (strcmp(argv[code], "-enable_process_stats")==0) {
rx_enableProcessRPCStats();
}
+#ifndef AFS_NT40_ENV
+ else if (strcmp(argv[code], "-syslog")==0) {
+ /* set syslog logging flag */
+ serverLogSyslog = 1;
+ }
+ else if (strncmp(argv[code], "-syslog=", 8)==0) {
+ serverLogSyslog = 1;
+ serverLogSyslogFacility = atoi(argv[code]+8);
+ }
+#endif
else {
printf("volserver: unrecognized flag '%s'\n", argv[code]);
usage:
printf("Usage: volserver [-log] [-p <number of processes>] "
"[-udpsize <size of socket buffer in bytes>] "
+#ifndef AFS_NT40_ENV
+ "[-syslog[=FACILITY]] "
+#endif
/* "[-enable_peer_stats] [-enable_process_stats] " */
"[-help]\n");
VS_EXIT(1);