changeset 2875:f68522e3df79 beta

more logging in pygrack
author Marcin Kuzminski <marcin@python-works.com>
date Fri, 28 Sep 2012 16:26:32 +0200
parents 95923493de9a
children b5b21af9ad28
files rhodecode/lib/middleware/pygrack.py
diffstat 1 files changed, 13 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/lib/middleware/pygrack.py	Fri Sep 28 15:57:57 2012 +0200
+++ b/rhodecode/lib/middleware/pygrack.py	Fri Sep 28 16:26:32 2012 +0200
@@ -2,6 +2,7 @@
 import socket
 import logging
 import subprocess
+import traceback
 
 from webob import Request, Response, exc
 
@@ -90,7 +91,7 @@
                 ]
             )
         except EnvironmentError, e:
-            log.exception(e)
+            log.error(traceback.format_exc())
             raise exc.HTTPExpectationFailed()
         resp = Response()
         resp.content_type = 'application/x-%s-advertisement' % str(git_command)
@@ -126,23 +127,25 @@
                 env=gitenv,
                 cwd=os.getcwd()
             )
-
+            cmd = r'git %s --stateless-rpc "%s"' % (git_command[4:],
+                                                    self.content_path),
+            log.debug('handling cmd %s' % cmd)
             out = subprocessio.SubprocessIOChunker(
-                r'git %s --stateless-rpc "%s"' % (git_command[4:],
-                                                  self.content_path),
+                cmd,
                 inputstream=inputstream,
                 **opts
             )
         except EnvironmentError, e:
-            log.exception(e)
+            log.error(traceback.format_exc())
             raise exc.HTTPExpectationFailed()
 
         if git_command in [u'git-receive-pack']:
             # updating refs manually after each push.
             # Needed for pre-1.7.0.4 git clients using regular HTTP mode.
-            subprocess.call(u'git --git-dir "%s" '
-                            'update-server-info' % self.content_path,
-                            shell=True)
+            cmd = (u'git --git-dir "%s" '
+                    'update-server-info' % self.content_path)
+            log.debug('handling cmd %s' % cmd)
+            subprocess.call(cmd, shell=True)
 
         resp = Response()
         resp.content_type = 'application/x-%s-result' % git_command.encode('utf8')
@@ -161,9 +164,9 @@
             resp = app(request, environ)
         except exc.HTTPException, e:
             resp = e
-            log.exception(e)
+            log.error(traceback.format_exc())
         except Exception, e:
-            log.exception(e)
+            log.error(traceback.format_exc())
             resp = exc.HTTPInternalServerError()
         return resp(environ, start_response)