--------------------- PatchSet 11697 Date: 2007/09/23 14:48:55 Author: adrian Branch: HEAD Tag: (none) Log: Make logfile module type selection per-log configuration; remove the 'logtype' configuration option. Members: src/access_log.c:1.102->1.103 src/cf.data.pre:1.429->1.430 src/logfile.c:1.26->1.27 src/net_db.c:1.175->1.176 src/protos.h:1.537->1.538 src/referer.c:1.7->1.8 src/store_log.c:1.28->1.29 src/structs.h:1.527->1.528 src/useragent.c:1.27->1.28 Index: squid/src/access_log.c =================================================================== RCS file: /cvsroot/squid/squid/src/access_log.c,v retrieving revision 1.102 retrieving revision 1.103 diff -u -r1.102 -r1.103 --- squid/src/access_log.c 23 Sep 2007 13:00:01 -0000 1.102 +++ squid/src/access_log.c 23 Sep 2007 14:48:55 -0000 1.103 @@ -1,6 +1,6 @@ /* - * $Id: access_log.c,v 1.102 2007/09/23 13:00:01 adrian Exp $ + * $Id: access_log.c,v 1.103 2007/09/23 14:48:55 adrian Exp $ * * DEBUG: section 46 Access Log * AUTHOR: Duane Wessels @@ -1247,7 +1247,7 @@ for (log = Config.Log.accesslogs; log; log = log->next) { if (log->type == CLF_NONE) continue; - log->logfile = logfileOpen(log->filename, Config.Log.logtype, MAX_URL << 2, 1); + log->logfile = logfileOpen(log->filename, MAX_URL << 2, 1); LogfileStatus = LOG_ENABLE; } #if HEADERS_LOG Index: squid/src/cf.data.pre =================================================================== RCS file: /cvsroot/squid/squid/src/cf.data.pre,v retrieving revision 1.429 retrieving revision 1.430 diff -u -r1.429 -r1.430 --- squid/src/cf.data.pre 23 Sep 2007 13:00:01 -0000 1.429 +++ squid/src/cf.data.pre 23 Sep 2007 14:48:55 -0000 1.430 @@ -1,6 +1,6 @@ # -# $Id: cf.data.pre,v 1.429 2007/09/23 13:00:01 adrian Exp $ +# $Id: cf.data.pre,v 1.430 2007/09/23 14:48:55 adrian Exp $ # # SQUID Web Proxy Cache http://www.squid-cache.org/ # ---------------------------------------------------------- @@ -2188,18 +2188,6 @@ logging will also not be accounted for in performance counters. DOC_END -NAME: logtype -TYPE: string -LOC: Config.Log.logtype -DEFAULT: stdio -DOC_START - Usage: - - logtype stdio|daemon|syslog - - Choose the logging method used to write access and store logs, if enabled. -DOC_END - NAME: logfile_daemon TYPE: string DEFAULT: @DEFAULT_LOGFILED@ Index: squid/src/logfile.c =================================================================== RCS file: /cvsroot/squid/squid/src/logfile.c,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- squid/src/logfile.c 23 Sep 2007 14:24:59 -0000 1.26 +++ squid/src/logfile.c 23 Sep 2007 14:48:55 -0000 1.27 @@ -1,5 +1,5 @@ /* - * $Id: logfile.c,v 1.26 2007/09/23 14:24:59 adrian Exp $ + * $Id: logfile.c,v 1.27 2007/09/23 14:48:55 adrian Exp $ * * DEBUG: section 50 Log file handling * AUTHOR: Duane Wessels @@ -39,12 +39,14 @@ #include "logfile_mod_syslog.h" #endif #include "logfile_mod_stdio.h" +#include "logfile_mod_udp.h" CBDATA_TYPE(Logfile); Logfile * -logfileOpen(const char *path, const char *type, size_t bufsz, int fatal_flag) +logfileOpen(const char *path, size_t bufsz, int fatal_flag) { Logfile *lf; + const char *patharg; int ret; debug(50, 1) ("Logfile: opening log %s\n", path); @@ -53,23 +55,28 @@ lf = cbdataAlloc(Logfile); cbdataLock(lf); xstrncpy(lf->path, path, MAXPATHLEN); + patharg = path; /* need to call the per-logfile-type code */ - if (strcmp(type, "stdio") == 0) { - ret = logfile_mod_stdio_open(lf, path, bufsz, fatal_flag); - } else if (strcmp(type, "daemon") == 0) { - ret = logfile_mod_daemon_open(lf, path, bufsz, fatal_flag); - } else if (strcmp(type, "udp") == 0) { - ret = logfile_mod_udp_open(lf, path, bufsz, fatal_flag); + if (strncmp(path, "stdio:", 6) == 0) { + patharg = path + 6; + ret = logfile_mod_stdio_open(lf, patharg, bufsz, fatal_flag); + } else if (strncmp(path, "daemon:", 7) == 0) { + patharg = path + 7; + ret = logfile_mod_daemon_open(lf, patharg, bufsz, fatal_flag); + } else if (strncmp(path, "udp:", 4) == 0) { + patharg = path + 4; + ret = logfile_mod_udp_open(lf, patharg, bufsz, fatal_flag); #if HAVE_SYSLOG - } else if (strcmp(type, "syslog") == 0) { - ret = logfile_mod_syslog_open(lf, path, bufsz, fatal_flag); + } else if (strncmp(path, "syslog:", 7) == 0) { + patharg = path + 7; + ret = logfile_mod_syslog_open(lf, patharg, bufsz, fatal_flag); #endif } else { - fatalf("logfileOpen: unknown logtype '%s'\n", type); + ret = logfile_mod_stdio_open(lf, patharg, bufsz, fatal_flag); } if (fatal_flag && !ret) { - fatalf("logfileOpen: type %s path %s: couldn't open!\n", type, path); + fatalf("logfileOpen: path %s: couldn't open!\n", path); } assert(lf->data != NULL); Index: squid/src/net_db.c =================================================================== RCS file: /cvsroot/squid/squid/src/net_db.c,v retrieving revision 1.175 retrieving revision 1.176 diff -u -r1.175 -r1.176 --- squid/src/net_db.c 18 Sep 2007 14:43:32 -0000 1.175 +++ squid/src/net_db.c 23 Sep 2007 14:48:55 -0000 1.176 @@ -1,6 +1,6 @@ /* - * $Id: net_db.c,v 1.175 2007/09/18 14:43:32 adrian Exp $ + * $Id: net_db.c,v 1.176 2007/09/23 14:48:55 adrian Exp $ * * DEBUG: section 38 Network Measurement Database * AUTHOR: Duane Wessels @@ -387,7 +387,7 @@ * logfileOpen() use O_TRUNC. */ unlink(path); - lf = logfileOpen(path, Config.Log.logtype, 4096, 0); + lf = logfileOpen(path, 4096, 0); if (NULL == lf) { debug(50, 1) ("netdbSaveState: %s: %s\n", path, xstrerror()); return; Index: squid/src/protos.h =================================================================== RCS file: /cvsroot/squid/squid/src/protos.h,v retrieving revision 1.537 retrieving revision 1.538 diff -u -r1.537 -r1.538 --- squid/src/protos.h 23 Sep 2007 14:24:59 -0000 1.537 +++ squid/src/protos.h 23 Sep 2007 14:48:55 -0000 1.538 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.537 2007/09/23 14:24:59 adrian Exp $ + * $Id: protos.h,v 1.538 2007/09/23 14:48:55 adrian Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -1335,7 +1335,7 @@ #endif /* logfile.c */ -extern Logfile *logfileOpen(const char *path, const char *type, size_t bufsz, int); +extern Logfile *logfileOpen(const char *path, size_t bufsz, int); extern void logfileClose(Logfile * lf); extern void logfileRotate(Logfile * lf); extern void logfileWrite(Logfile * lf, char *buf, size_t len); Index: squid/src/referer.c =================================================================== RCS file: /cvsroot/squid/squid/src/referer.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- squid/src/referer.c 18 Sep 2007 14:43:32 -0000 1.7 +++ squid/src/referer.c 23 Sep 2007 14:48:55 -0000 1.8 @@ -1,6 +1,6 @@ /* - * $Id: referer.c,v 1.7 2007/09/18 14:43:32 adrian Exp $ + * $Id: referer.c,v 1.8 2007/09/23 14:48:55 adrian Exp $ * * DEBUG: section 40 User-Agent and Referer logging * AUTHOR: Joe Ramey (useragent) @@ -49,7 +49,7 @@ debug(40, 1) ("Referer logging is disabled.\n"); return; } - refererlog = logfileOpen(Config.Log.referer, Config.Log.logtype, 0, 1); + refererlog = logfileOpen(Config.Log.referer, 0, 1); #endif } Index: squid/src/store_log.c =================================================================== RCS file: /cvsroot/squid/squid/src/store_log.c,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- squid/src/store_log.c 18 Sep 2007 14:43:32 -0000 1.28 +++ squid/src/store_log.c 23 Sep 2007 14:48:55 -0000 1.29 @@ -1,6 +1,6 @@ /* - * $Id: store_log.c,v 1.28 2007/09/18 14:43:32 adrian Exp $ + * $Id: store_log.c,v 1.29 2007/09/23 14:48:55 adrian Exp $ * * DEBUG: section 20 Storage Manager Logging Functions * AUTHOR: Duane Wessels @@ -120,5 +120,5 @@ debug(20, 1) ("Store logging disabled\n"); return; } - storelog = logfileOpen(Config.Log.store, Config.Log.logtype, 0, 1); + storelog = logfileOpen(Config.Log.store, 0, 1); } Index: squid/src/structs.h =================================================================== RCS file: /cvsroot/squid/squid/src/structs.h,v retrieving revision 1.527 retrieving revision 1.528 diff -u -r1.527 -r1.528 --- squid/src/structs.h 23 Sep 2007 13:00:01 -0000 1.527 +++ squid/src/structs.h 23 Sep 2007 14:48:55 -0000 1.528 @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.527 2007/09/23 13:00:01 adrian Exp $ + * $Id: structs.h,v 1.528 2007/09/23 14:48:55 adrian Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -528,7 +528,6 @@ #endif logformat *logformats; customlog *accesslogs; - char *logtype; int rotateNumber; } Log; char *adminEmail; Index: squid/src/useragent.c =================================================================== RCS file: /cvsroot/squid/squid/src/useragent.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- squid/src/useragent.c 18 Sep 2007 14:43:32 -0000 1.27 +++ squid/src/useragent.c 23 Sep 2007 14:48:55 -0000 1.28 @@ -1,6 +1,6 @@ /* - * $Id: useragent.c,v 1.27 2007/09/18 14:43:32 adrian Exp $ + * $Id: useragent.c,v 1.28 2007/09/23 14:48:55 adrian Exp $ * * DEBUG: section 40 User-Agent logging * AUTHOR: Joe Ramey @@ -48,7 +48,7 @@ debug(40, 1) ("User-Agent logging is disabled.\n"); return; } - useragentlog = logfileOpen(Config.Log.useragent, Config.Log.logtype, 0, 1); + useragentlog = logfileOpen(Config.Log.useragent, 0, 1); #endif }