2

I’ve got Subversion installed as an Apache module and it is set up and works just fine. The only problem is that I get all of the SVN stuff (eg PROPFIND, OPTIONS, etc.) logged to the same .LOG file as normal web accesses. I am trying to figure out how to get the SVN module to report to a custom log file.

Here is the part of my Apache conf file that loads the SVN module. I tried doing it with the CustomLog directive (as seen at the bottom), but that did not work.

################################################
#Subversion modules
LoadModule  dav_svn_module    "C:/SVN/bin/mod_dav_svn.so"
LoadModule  authz_svn_module  "C:/SVN/bin/mod_authz_svn.so"

# Configure Subversion repository
# This configures Apache so that all your Subversion repositories
# are available at http://myserver/svn/[repositoryName]
# The access is restricted to known users/passwords.
<Location             /svn/>
  DAV                 svn
  SVNIndexXSLT        "/svnindex.xsl"
  SVNParentPath       "C:/SVNRep/Repository/"
  SVNListParentPath   on
# SVNPath             "C:/SVNRep/Repository/" #for single repository 
  SVNPathAuthz        off
# SVNMasterURI        http://localhost/svn/ #for write-through proxying
  AuthType            Basic
  AuthName            "My Subversion repositories"
  AuthUserFile        "C:/SVNRep/passwd"
  Require             valid-user
  AuthzSVNAccessFile  "C:/SVNRep/acl"
</Location>
CustomLog "C:/Logs/Apache/SVN.log"  "%t %u %{SVN-ACTION}e" env=SVN-ACTION
################################################


Any ideas?

Thanks a lot.

2
  • Is mod_log_config installed/enabled and I assume you restarted apache after making these changes?
    – Jack
    Jul 29, 2009 at 21:48
  • Yes, mod_log_config is installed and enabled (I have functioning CustomLog directives for VirtualHosts). And yes, I have restarted Apache. Thanks for the suggestions though.
    – Synetech
    Jul 30, 2009 at 0:07

2 Answers 2

1

Except for the log path different from *nix to Windows what you have is exactly what I have configured and works on various servers - possibly the SVN-ACTION isn't making its way into env on windows? As a workaround you could try:

SetEnvIf Request_URI "^/svn/*" mysvn
CustomLog "C:/Logs/Apache/SVN.log" combined env=mysvn

This obviously won't be as friendly as logging %{SVN-ACTION}e but it will split all requests to /svn to their own log.

1
  • Hmm, I wonder if that is the case. I am using Apache 2.2, so if I can confirm that is the problem, then I guess I should report it. I’ll try the workaround you suggested and see if it works. Thanks.
    – Synetech
    Jul 30, 2009 at 14:03
1

Well I figured it out. After a lot of searching (which found a few others asking the same thing, but not as many as I would have expected), I came up with the solution by serendipity. While watching a show, during the commercial I got to thinking about what it would take to completely segregate Subversion from the web server (as in a separate server altogether). Then I wondered why the Subversion entries were flooding the web server logs while my other VirtualHosts were not (they were using their own logs as desired). Then it hit me: I have SVN set up in the main web server, not a Virtual Host! So that is the answer.

To have Subversion log to its own LOG file and not flood the main Apache log file, just put the SVN directives (eg Location…) in its own, dedicated Virtual Host.

This way, I can connect to the SVN virtual host with the SVN client, and to the web server with a web browser. Duh. :) So simple; no hacks, no workarounds, nothing. It’s curious why putting the SVN location in a Virtual Host doesn’t seem to be in many examples—I saw it in only one! out of a couple of dozen examples.

(Of course the main log files will still get OPTIONS, PROPFIND, etc. entries if you try to connect to it with an SVN client, but that is correct behavior.)

Here is an example:

<VirtualHost 127.200.200.200:80>
    <Directory "C:/Subversion/Repositories/">
        Options Indexes Includes
        Order   Deny,Allow
        Allow   from all
    </Directory>

    ServerName   svn
    ServerAdmin  [email protected]
    DocumentRoot "C:/Subversion/Repositories/"

    ErrorLog  "C:/Logs/SVN/error.log"
    CustomLog "C:/Logs/SVN/access.log"  common
    CustomLog "C:/Logs/SVN/referer.log" referer
    CustomLog "C:/Logs/SVN/agent.log"   agent

    LoadModule dav_svn_module   "C:/SVN/bin/mod_dav_svn.so"
    LoadModule authz_svn_module "C:/SVN/bin/mod_authz_svn.so"

    <Location /svn/>
      DAV                 svn
      SVNParentPath       "C:/Subversion/"
      SVNListParentPath   on
      SVNPathAuthz        off
      AuthType            Basic
      AuthName            "My Subversion Repositories"
      AuthUserFile        "C:/Subversion/passwd"
      Require             valid-user
      AuthzSVNAccessFile  "C:/Subversion/acl"
    </Location>
</VirtualHost>

There you have it. Now I wonder if I can track down those people that asked this question…

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .