You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2013/11/13 16:42:32 UTC

svn commit: r1541561 - in /subversion/trunk: notes/knobs subversion/include/svn_config.h subversion/libsvn_ra_serf/serf.c

Author: rhuijben
Date: Wed Nov 13 15:42:32 2013
New Revision: 1541561

URL: http://svn.apache.org/r1541561
Log:
Add some initial support for the logging framework that should be available in
Serf 1.4.0 and later.

This should allow getting some logging output on stderr with:
$ svn --config-option servers:global:serf-log-components=255 \
      ls https://svn.apache.org/repos/asf/subversion

And all output with
$ svn --config-option servers:global:serf-log-components=255 \
      --config-option servers:global:serf-log-level=8 \
      ls https://svn.apache.org/repos/asf/subversion

Currently you need to compile against serf trunk to enable this.

* notes/knobs
  Add SVN_SERF_NO_LOGGING.

* subversion/include/svn_config.h
  (SVN_CONFIG_OPTION_SERF_LOG_COMPONENTS,
   SVN_CONFIG_OPTION_SERF_LOG_LEVEL): New define.

* subversion/libsvn_ra_serf/serf.c
  (load_config): When serf >= 1.4 load serf log configuration.

Modified:
    subversion/trunk/notes/knobs
    subversion/trunk/subversion/include/svn_config.h
    subversion/trunk/subversion/libsvn_ra_serf/serf.c

Modified: subversion/trunk/notes/knobs
URL: http://svn.apache.org/viewvc/subversion/trunk/notes/knobs?rev=1541561&r1=1541560&r2=1541561&view=diff
==============================================================================
--- subversion/trunk/notes/knobs (original)
+++ subversion/trunk/notes/knobs Wed Nov 13 15:42:32 2013
@@ -52,6 +52,7 @@ SVN_FS_FS_DELTIFY_DIRECTORIES
 SVN_FS_FS_DELTIFY_PROPS
 SVN_SQLITE_MIN_VERSION_NUMBER
 SVN_SQLITE_MIN_VERSION
+SVN_SERF_NO_LOGGING
 
 2.3 Debugging Support
 

Modified: subversion/trunk/subversion/include/svn_config.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_config.h?rev=1541561&r1=1541560&r2=1541561&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_config.h (original)
+++ subversion/trunk/subversion/include/svn_config.h Wed Nov 13 15:42:32 2013
@@ -98,6 +98,12 @@ typedef struct svn_config_t svn_config_t
 /** @since New in 1.9. */
 #define SVN_CONFIG_OPTION_HTTP_CHUNKED_REQUESTS     "http-chunked-requests"
 
+/** @since New in 1.9. */
+#define SVN_CONFIG_OPTION_SERF_LOG_COMPONENTS       "serf-log-components"
+/** @since New in 1.9. */
+#define SVN_CONFIG_OPTION_SERF_LOG_LEVEL            "serf-log-level"
+
+
 #define SVN_CONFIG_CATEGORY_CONFIG          "config"
 #define SVN_CONFIG_SECTION_AUTH                 "auth"
 #define SVN_CONFIG_OPTION_PASSWORD_STORES           "password-stores"

Modified: subversion/trunk/subversion/libsvn_ra_serf/serf.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/serf.c?rev=1541561&r1=1541560&r2=1541561&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/serf.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/serf.c Wed Nov 13 15:42:32 2013
@@ -157,6 +157,10 @@ load_config(svn_ra_serf__session_t *sess
   const char *exceptions;
   apr_port_t proxy_port;
   svn_tristate_t chunked_requests;
+#if SERF_VERSION_AT_LEAST(1, 4, 0) && !defined(SVN_SERF_NO_LOGGING)
+  apr_int64_t log_components;
+  apr_int64_t log_level;
+#endif
 
   if (config_hash)
     {
@@ -239,6 +243,17 @@ load_config(svn_ra_serf__session_t *sess
                                   SVN_CONFIG_OPTION_HTTP_CHUNKED_REQUESTS,
                                   "auto", svn_tristate_unknown));
 
+#if SERF_VERSION_AT_LEAST(1, 4, 0) && !defined(SVN_SERF_NO_LOGGING)
+  SVN_ERR(svn_config_get_int64(config, &log_components,
+                               SVN_CONFIG_SECTION_GLOBAL,
+                               SVN_CONFIG_OPTION_SERF_LOG_COMPONENTS,
+                               SERF_LOGCOMP_NONE));
+  SVN_ERR(svn_config_get_int64(config, &log_level,
+                               SVN_CONFIG_SECTION_GLOBAL,
+                               SVN_CONFIG_OPTION_SERF_LOG_LEVEL,
+                               SERF_LOG_INFO));
+#endif
+
   if (config)
     server_group = svn_config_find_group(config,
                                          session->session_url.hostname,
@@ -301,7 +316,37 @@ load_config(svn_ra_serf__session_t *sess
                                       server_group,
                                       SVN_CONFIG_OPTION_HTTP_CHUNKED_REQUESTS,
                                       "auto", chunked_requests));
+
+#if SERF_VERSION_AT_LEAST(1, 4, 0) && !defined(SVN_SERF_NO_LOGGING)
+      SVN_ERR(svn_config_get_int64(config, &log_components,
+                                   server_group,
+                                   SVN_CONFIG_OPTION_SERF_LOG_COMPONENTS,
+                                   log_components));
+       SVN_ERR(svn_config_get_int64(config, &log_level,
+                                    server_group,
+                                    SVN_CONFIG_OPTION_SERF_LOG_LEVEL,
+                                    log_level));
+#endif
+    }
+
+#if SERF_VERSION_AT_LEAST(1, 4, 0) && !defined(SVN_SERF_NO_LOGGING)
+  if (log_components != SERF_LOGCOMP_NONE)
+    {
+      serf_log_output_t *output;
+      apr_status_t status;
+
+      status = serf_logging_create_stream_output(&output,
+                                                 session->context,
+                                                 (apr_uint32_t)log_level,
+                                                 (apr_uint32_t)log_components,
+                                                 SERF_LOG_DEFAULT_LAYOUT,
+                                                 stderr,
+                                                 pool);
+
+      if (!status)
+          serf_logging_add_output(session->context, output);
     }
+#endif
 
   /* Don't allow the http-max-connections value to be larger than our
      compiled-in limit, or to be too small to operate.  Broken