[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] proof-of-concept for svnserve logging

From: David Glasser <glasser_at_davidglasser.net>
Date: Fri, 15 Feb 2008 17:13:53 -0800

svnserve logging has been punted for years in search of a
fully-fleshed-out solution. This is fine. But to start with, here's
a proof of concept (which does, to some degree, actually work), just
for the record.

[[[
Half-assed, written in an hour, implementation of svnserve logging.

To use: just add --log-file FILE to the svnserve invocation.
Makes lines like:

  8795 127.0.0.1 glasser 2008-02-16T01:01:37.446493Z update

- It just logs the name of the command executed; nothing more.

- I tested it in forking mode; I believe that it works there; no
  promise that it does anything useful in threaded or inetd mode. And
  don't point multiple svnserve invocations at the same file.

- svnserve doesn't have any HUPability, which makes rotation tough.

- Just logs IP without trying to look up hostname.

- Probably should cache the time string.

- Format is not configurable.

* subversion/include/svn_ra_svn.h
  (svn_ra_svn_conn_remote_host): New.

* subversion/libsvn_ra_svn/ra_svn.h
  (struct svn_ra_svn_conn_st): Add remote_ip field.

* subversion/libsvn_ra_svn/marshal.c
  (svn_ra_svn_create_conn): Initialize remote_ip field.
  (svn_ra_svn_conn_remote_host): New, returning remote_ip.

* subversion/svnserve/main.c
  (SVNSERVE_OPT_LOG_FILE): New.
  (svnserve__options): Add --log-file.
  (main): If --log-file passed, open a filehandle in the server
   params.

* subversion/svnserve/serve.c
  Include unistd.h (for getpid).
  (svnserve_log): New.
  (SLOG): New macro.
  (serve): Copy filehandle from server params to server baton.
  (reparent, get_latest_rev, get_dated_rev, change_rev_prop,
   rev_proplist, rev_prop, commit, get_file, get_dir, update,
   switch_cmd, status, diff, get_mergeinfo, log_cmd, check_path, stat,
   get_locations, get_location_segments, get_file_revs, lock,
   lock_many, unlock, unlock_many, get_lock, get_locks, replay,
   replay_range): Call SLOG.

* subversion/svnserve/server.h
  (struct server_baton_t, struct serve_params_t): Add log_file field.
]]]

-- 
David Glasser | glasser@davidglasser.net | http://www.davidglasser.net/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org

Received on 2008-02-16 02:14:09 CET

This is an archived mail posted to the Subversion Dev mailing list.