Index: squid/src/debug.c diff -c squid/src/debug.c:1.84 squid/src/debug.c:1.84.2.1 *** squid/src/debug.c:1.84 Mon Dec 17 11:01:54 2001 --- squid/src/debug.c Tue Apr 5 17:02:08 2005 *************** *** 40,45 **** --- 40,48 ---- static const char *debugLogTime(time_t); static void ctx_print(void); #if HAVE_SYSLOG + #ifdef LOG_LOCAL4 + static int syslog_facility = 0; + #endif static void _db_print_syslog(const char *format, va_list args); #endif static void _db_print_stderr(const char *format, va_list args); *************** *** 182,187 **** --- 185,332 ---- #endif } + #if HAVE_SYSLOG + #ifdef LOG_LOCAL4 + static struct syslog_facility_name { + const char *name; + int facility; + } syslog_facility_names[] = { + + #ifdef LOG_AUTH + { + "auth", LOG_AUTH + }, + #endif + #ifdef LOG_AUTHPRIV + { + "authpriv", LOG_AUTHPRIV + }, + #endif + #ifdef LOG_CRON + { + "cron", LOG_CRON + }, + #endif + #ifdef LOG_DAEMON + { + "daemon", LOG_DAEMON + }, + #endif + #ifdef LOG_FTP + { + "ftp", LOG_FTP + }, + #endif + #ifdef LOG_KERN + { + "kern", LOG_KERN + }, + #endif + #ifdef LOG_LPR + { + "lpr", LOG_LPR + }, + #endif + #ifdef LOG_MAIL + { + "mail", LOG_MAIL + }, + #endif + #ifdef LOG_NEWS + { + "news", LOG_NEWS + }, + #endif + #ifdef LOG_SYSLOG + { + "syslog", LOG_SYSLOG + }, + #endif + #ifdef LOG_USER + { + "user", LOG_USER + }, + #endif + #ifdef LOG_UUCP + { + "uucp", LOG_UUCP + }, + #endif + #ifdef LOG_LOCAL0 + { + "local0", LOG_LOCAL0 + }, + #endif + #ifdef LOG_LOCAL1 + { + "local1", LOG_LOCAL1 + }, + #endif + #ifdef LOG_LOCAL2 + { + "local2", LOG_LOCAL2 + }, + #endif + #ifdef LOG_LOCAL3 + { + "local3", LOG_LOCAL3 + }, + #endif + #ifdef LOG_LOCAL4 + { + "local4", LOG_LOCAL4 + }, + #endif + #ifdef LOG_LOCAL5 + { + "local5", LOG_LOCAL5 + }, + #endif + #ifdef LOG_LOCAL6 + { + "local6", LOG_LOCAL6 + }, + #endif + #ifdef LOG_LOCAL7 + { + "local7", LOG_LOCAL7 + }, + #endif + { + NULL, 0 + } + }; + + #endif + + void + _db_set_syslog(const char *facility) + { + opt_syslog_enable = 1; + #ifdef LOG_LOCAL4 + #ifdef LOG_DAEMON + syslog_facility = LOG_DAEMON; + #else + syslog_facility = LOG_LOCAL4; + #endif + if (facility) { + struct syslog_facility_name *n; + for (n = syslog_facility_names; n->name; n++) { + if (strcmp(n->name, facility) == 0) { + syslog_facility = n->facility; + return; + } + } + fprintf(stderr, "unknown syslog facility '%s'\n", facility); + exit(1); + } + #else + if (facility) + fprintf(stderr, "syslog facility type not supported on your system\n"); + #endif + } + #endif + void _db_init(const char *logfile, const char *options) { *************** *** 202,208 **** #if HAVE_SYSLOG && defined(LOG_LOCAL4) if (opt_syslog_enable) ! openlog(appname, LOG_PID | LOG_NDELAY | LOG_CONS, LOG_LOCAL4); #endif /* HAVE_SYSLOG */ } --- 347,353 ---- #if HAVE_SYSLOG && defined(LOG_LOCAL4) if (opt_syslog_enable) ! openlog(appname, LOG_PID | LOG_NDELAY | LOG_CONS, syslog_facility); #endif /* HAVE_SYSLOG */ } Index: squid/src/main.c diff -c squid/src/main.c:1.345.2.22 squid/src/main.c:1.345.2.23 *** squid/src/main.c:1.345.2.22 Sat Mar 19 16:56:23 2005 --- squid/src/main.c Tue Apr 5 17:02:08 2005 *************** *** 41,46 **** --- 41,47 ---- static int opt_send_signal = -1; static int opt_no_daemon = 0; static int opt_parse_cfg_only = 0; + static char *opt_syslog_facility = NULL; static int httpPortNumOverride = 1; static int icpPortNumOverride = 1; /* Want to detect "-u 0" */ static int configured_once = 0; *************** *** 83,89 **** usage(void) { fprintf(stderr, ! "Usage: %s [-dhsvzCDFNRVYX] [-f config-file] [-[au] port] [-k signal]\n" " -a port Specify HTTP port number (default: %d).\n" " -d level Write debugging to stderr also.\n" " -f file Use given config-file instead of\n" --- 84,90 ---- usage(void) { fprintf(stderr, ! "Usage: %s [-dhvzCDFNRVYX] [-s | -l facility] [-f config-file] [-[au] port] [-k signal]\n" " -a port Specify HTTP port number (default: %d).\n" " -d level Write debugging to stderr also.\n" " -f file Use given config-file instead of\n" *************** *** 92,98 **** " -k reconfigure|rotate|shutdown|interrupt|kill|debug|check|parse\n" " Parse configuration file, then send signal to \n" " running copy (except -k parse) and exit.\n" ! " -s Enable logging to syslog.\n" " -u port Specify ICP port number (default: %d), disable with 0.\n" " -v Print version.\n" " -z Create swap directories\n" --- 93,100 ---- " -k reconfigure|rotate|shutdown|interrupt|kill|debug|check|parse\n" " Parse configuration file, then send signal to \n" " running copy (except -k parse) and exit.\n" ! " -s | -l facility\n" ! " Enable logging to syslog.\n" " -u port Specify ICP port number (default: %d), disable with 0.\n" " -v Print version.\n" " -z Create swap directories\n" *************** *** 115,121 **** extern char *optarg; int c; ! while ((c = getopt(argc, argv, "CDFNRSVYXa:d:f:hk:m::su:vz?")) != -1) { switch (c) { case 'C': opt_catch_signals = 0; --- 117,123 ---- extern char *optarg; int c; ! while ((c = getopt(argc, argv, "CDFNRSVYXa:d:f:hk:m::sl:u:vz?")) != -1) { switch (c) { case 'C': opt_catch_signals = 0; *************** *** 205,213 **** fatal("Need to configure --enable-xmalloc-debug-trace to use -m option"); #endif } case 's': #if HAVE_SYSLOG ! opt_syslog_enable = 1; break; #else fatal("Logging to syslog not available on this platform"); --- 207,217 ---- fatal("Need to configure --enable-xmalloc-debug-trace to use -m option"); #endif } + case 'l': + opt_syslog_facility = xstrdup(optarg); case 's': #if HAVE_SYSLOG ! _db_set_syslog(opt_syslog_facility); break; #else fatal("Logging to syslog not available on this platform"); Index: squid/src/protos.h diff -c squid/src/protos.h:1.420.2.32 squid/src/protos.h:1.420.2.33 *** squid/src/protos.h:1.420.2.32 Sun Apr 3 17:08:48 2005 --- squid/src/protos.h Tue Apr 5 17:02:08 2005 *************** *** 206,211 **** --- 206,212 ---- extern Ctx ctx_enter(const char *descr); extern void ctx_exit(Ctx ctx); + extern void _db_set_syslog(const char *facility); extern void _db_init(const char *logfile, const char *options); extern void _db_rotate_log(void); Index: squid/doc/squid.8 diff -c squid/doc/squid.8:1.1 squid/doc/squid.8:1.1.2.1 *** squid/doc/squid.8:1.1 Mon Dec 18 14:54:18 2000 --- squid/doc/squid.8 Tue Apr 19 16:11:11 2005 *************** *** 8,13 **** --- 8,15 ---- [ .B \-dhsvzCDFNRVYX ] [ + .BI \-l " facility" + ] [ .BI \-f " config-file" ] [ \-[ *************** *** 75,80 **** --- 77,84 ---- (except -k parse) and exit. .IP -s Enable logging to syslog. + .IP "-l facility" + Use specified syslog facility. implies -s .IP "-u port" Specify ICP port number (default: 3130), disable with 0. .IP -v

AltStyle によって変換されたページ (->オリジナル) /