You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2013/12/14 22:51:54 UTC

[45/50] git commit: TS-2190: remove cache.log from the cacheurl plugin

TS-2190: remove cache.log from the cacheurl plugin

The information in the cacheurl plugin log is for debugging purposes,
but you can already get that from diagnostics.  Remove the log file
since it's not really useful and it's better to have fewer logfiles.


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/1410994d
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/1410994d
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/1410994d

Branch: refs/heads/5.0.x
Commit: 1410994d448d0352f705110a6c4efc9f947825ea
Parents: 6100526
Author: James Peach <jp...@apache.org>
Authored: Tue Dec 10 21:00:39 2013 -0800
Committer: James Peach <jp...@apache.org>
Committed: Wed Dec 11 16:00:15 2013 -0800

----------------------------------------------------------------------
 CHANGES                     |  2 ++
 plugins/cacheurl/cacheurl.c | 36 ++----------------------------------
 2 files changed, 4 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1410994d/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 30afc6c..22608c4 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,8 @@
 Changes with Apache Traffic Server 4.2.0
 
 
+  *) [TS-2190] Remove cache.log from the cachurl plugin.
+
   *) [TS-2426] Add a new plugin, xdebug, for cache debugging using HTTP headers.
 
   *) [TS-2077] Remove pipeline configurations, they were no-op's anyways. We

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1410994d/plugins/cacheurl/cacheurl.c
----------------------------------------------------------------------
diff --git a/plugins/cacheurl/cacheurl.c b/plugins/cacheurl/cacheurl.c
index 1779bae..3b3e98d 100644
--- a/plugins/cacheurl/cacheurl.c
+++ b/plugins/cacheurl/cacheurl.c
@@ -57,8 +57,6 @@ typedef struct {
     //pr_list *next; /* Link to next set of patterns, if any */
 } pr_list;
 
-static TSTextLogObject log = NULL;
-
 static int regex_substitute(char **buf, char *str, regex_info *info) {
     int matchcount;
     int ovector[OVECOUNT]; /* Locations of matches in regex */
@@ -261,13 +259,7 @@ static pr_list* load_config_file(const char *config_file) {
         /* We have the pattern/replacement, now do precompilation.
          * buffer is the first part of the line. spend is the second part just
          * after the whitespace */
-        if (log) {
-            TSTextLogObjectWrite(log,
-                    "Adding pattern/replacement pair: '%s' -> '%s'",
-                    buffer, spend);
-        }
-        TSDebug(PLUGIN_NAME, "Adding pattern/replacement pair: '%s' -> '%s'\n",
-                buffer, spend);
+        TSDebug(PLUGIN_NAME, "Adding pattern/replacement pair: '%s' -> '%s'", buffer, spend);
         retval = regex_compile(&info, buffer, spend);
         if (!retval) {
             TSError("[%s] Error precompiling regex/replacement. Skipping.\n",
@@ -319,13 +311,7 @@ static int rewrite_cacheurl(pr_list *prl, TSHttpTxn txnp) {
             i++;
         }
         if (newurl) {
-            if (log) {
-                TSTextLogObjectWrite(log,
-                        "Rewriting cache URL for %s to %s", url,
-                        newurl);
-            }
-            TSDebug(PLUGIN_NAME, "Rewriting cache URL for %s to %s\n",
-                    url, newurl);
+            TSDebug(PLUGIN_NAME, "Rewriting cache URL for %s to %s", url, newurl);
             if (TSCacheUrlSet(txnp, newurl, strlen(newurl))
                     != TS_SUCCESS) {
                 TSError("[%s] Unable to modify cache url from "
@@ -391,16 +377,6 @@ TSReturnCode TSRemapInit(TSRemapInterface *api_info, char *errbuf,
         return TS_ERROR;
     }
 
-    if (!log) {
-        error = TSTextLogObjectCreate("cacheurl", TS_LOG_MODE_ADD_TIMESTAMP,
-                &log);
-        if (!log || error == TS_ERROR) {
-            snprintf(errbuf, errbuf_size - 1,
-                "[%s] Error creating log file\n", PLUGIN_NAME);
-            return TS_ERROR;
-        }
-    }
-
     TSDebug(PLUGIN_NAME, "remap plugin is successfully initialized");
     return TS_SUCCESS;
 }
@@ -453,14 +429,6 @@ void TSPluginInit(int argc, const char *argv[]) {
         return;
     }
 
-    if (!log) {
-        error = TSTextLogObjectCreate("cacheurl", TS_LOG_MODE_ADD_TIMESTAMP,
-                &log);
-        if (!log || error == TS_ERROR) {
-            TSError("[%s] Error creating log file\n", PLUGIN_NAME);
-        }
-    }
-
     prl = load_config_file(argc > 1 ? argv[1] : NULL);
 
     contp = TSContCreate((TSEventFunc)handle_hook, NULL);