Permalink
Browse files

Fix debug logger breakage introduced by last change, #123.

  • Loading branch information...
1 parent 1416089 commit 4cdd761ccc3719d63babdfc3c91d513e663df79b Simon Haswell committed Feb 12, 2013
Showing with 17 additions and 15 deletions.
  1. +5 −0 application.wsgi
  2. +6 −0 pybit_web.py
  3. +2 −5 pybitweb/controller.py
  4. +2 −5 pybitweb/db.py
  5. +2 −5 pybitweb/job.py
View
@@ -9,10 +9,15 @@ import optparse
import site
import pybit
import pybitweb
+import logging
+import sys
from pybitweb.db import Database
from pybitweb.controller import Controller
(settings, opened_path) = pybit.load_settings("web/web.conf")
+FORMAT = '%(asctime)s %(filename)s:%(lineno)d %(msg)s'
+logging.basicConfig( stream=sys.stderr, level=logging.WARN)
+logging.basicConfig( format=FORMAT )
myDb = Database(settings['db']) # singleton instance
buildController = Controller(settings, myDb) # singleton instance
application = pybitweb.get_app(settings,myDb,buildController)
View
@@ -31,6 +31,8 @@
import pybitweb
from pybitweb import bottle
import pybit
+import logging
+import sys
META="PYBIT_WEB_"
@@ -52,6 +54,10 @@
(settings, opened_file) = pybit.load_settings(options.config)
settings = pybit.merge_options(settings, groupConfigFile, options)
+ FORMAT = '%(asctime)s %(filename)s:%(lineno)d %(msg)s'
+ logging.basicConfig( stream=sys.stderr, level=logging.WARN)
+ logging.basicConfig( format=FORMAT )
+
myDb = Database(settings['db']) # singleton instance
buildController = Controller(settings, myDb) # singleton instance - Needs access to both controller and web settings
# try:
View
@@ -59,12 +59,9 @@ def get_amqp_channel(self):
def __init__(self, settings, db):
self.db = db
self.settings = settings
- if (('debug' in self.settings['controller']) and ( self.settings['controller']['debug'])) :
- FORMAT = '%(asctime)s %(filename)s:%(lineno)d %(msg)s'
- logging.basicConfig(format=FORMAT)
- logging.basicConfig( stream=sys.stderr )
- logging.getLogger( "controller" ).setLevel( logging.DEBUG )
self.log = logging.getLogger( "controller" )
+ if (('debug' in self.settings['controller']) and ( self.settings['controller']['debug'])) :
+ self.log.setLevel( logging.DEBUG )
self.log.debug("Controller constructor called.")
def process_job(self, dist, architectures, version, name, suite, pkg_format, transport, build_environment = None) :
View
@@ -60,12 +60,9 @@ class Database(object):
def __init__(self, settings):
self.settings = settings
+ self.log = logging.getLogger("db" )
if (('debug' in self.settings) and ( self.settings['debug'])) :
- FORMAT = '%(asctime)s %(filename)s:%(lineno)d %(msg)s'
- logging.basicConfig(format=FORMAT)
- logging.basicConfig( stream=sys.stderr )
- logging.getLogger( "db" ).setLevel( logging.DEBUG )
- self.log = logging.getLogger( "db" )
+ self.log.setLevel( logging.DEBUG )
self.log.debug("DB constructor called.")
self.connect()
#Deconstructor, disconnects on disposal.
View
@@ -38,12 +38,9 @@ def get_job_app(settings, db, controller) :
app = Bottle()
app.config={'settings':settings, 'db':db, 'controller': controller}
- if (('debug' in settings['web']) and ( settings['web']['debug'])) :
- FORMAT = '%(asctime)s %(filename)s:%(lineno)d %(msg)s'
- logging.basicConfig(format=FORMAT)
- logging.basicConfig( stream=sys.stderr )
- logging.getLogger( "web" ).setLevel( logging.DEBUG )
app.log = logging.getLogger( "web" )
+ if (('debug' in settings['web']) and ( settings['web']['debug'])) :
+ app.log.setLevel( logging.DEBUG )
@app.route('/vcshook', method='POST')
@app.route('/vcshook', method='PUT')

0 comments on commit 4cdd761

Please sign in to comment.