Skip to content

Commit a7d8732

Browse files
author
Ralf Schlatterbeck
committed
- more logger fixes, sorry for the noise.
1 parent ba6cc0c commit a7d8732

File tree

6 files changed

+34
-25
lines changed

6 files changed

+34
-25
lines changed

roundup/backends/back_anydbm.py

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ def opendb(self, name, mode):
224224
# whichdb() function to do this
225225
if not db_type or hasattr(anydbm, 'whichdb'):
226226
if __debug__:
227-
logging.getLogger('hyperdb').debug(
227+
logging.getLogger('roundup.hyperdb').debug(
228228
"opendb anydbm.open(%r, 'c')"%path)
229229
return anydbm.open(path, 'c')
230230

@@ -236,7 +236,7 @@ def opendb(self, name, mode):
236236
raise hyperdb.DatabaseError(_("Couldn't open database - the "
237237
"required module '%s' is not available")%db_type)
238238
if __debug__:
239-
logging.getLogger('hyperdb').debug(
239+
logging.getLogger('roundup.hyperdb').debug(
240240
"opendb %r.open(%r, %r)"%(db_type, path, mode))
241241
return dbm.open(path, mode)
242242

@@ -297,7 +297,8 @@ def savenode(self, classname, nodeid, node):
297297
""" perform the saving of data specified by the set/addnode
298298
"""
299299
if __debug__:
300-
logging.getLogger('hyperdb').debug('save %s%s %r'%(classname, nodeid, node))
300+
logging.getLogger('roundup.hyperdb').debug(
301+
'save %s%s %r'%(classname, nodeid, node))
301302
self.transactions.append((self.doSaveNode, (classname, nodeid, node)))
302303

303304
def getnode(self, classname, nodeid, db=None, cache=1):
@@ -310,14 +311,16 @@ def getnode(self, classname, nodeid, db=None, cache=1):
310311
cache_dict = self.cache.setdefault(classname, {})
311312
if nodeid in cache_dict:
312313
if __debug__:
313-
logging.getLogger('hyperdb').debug('get %s%s cached'%(classname, nodeid))
314+
logging.getLogger('roundup.hyperdb').debug(
315+
'get %s%s cached'%(classname, nodeid))
314316
self.stats['cache_hits'] += 1
315317
return cache_dict[nodeid]
316318

317319
if __debug__:
318320
self.stats['cache_misses'] += 1
319321
start_t = time.time()
320-
logging.getLogger('hyperdb').debug('get %s%s'%(classname, nodeid))
322+
logging.getLogger('roundup.hyperdb').debug(
323+
'get %s%s'%(classname, nodeid))
321324

322325
# get from the database and save in the cache
323326
if db is None:
@@ -349,7 +352,8 @@ def destroynode(self, classname, nodeid):
349352
"""Remove a node from the database. Called exclusively by the
350353
destroy() method on Class.
351354
"""
352-
logging.getLogger('hyperdb').info('destroy %s%s'%(classname, nodeid))
355+
logging.getLogger('roundup.hyperdb').info(
356+
'destroy %s%s'%(classname, nodeid))
353357

354358
# remove from cache and newnodes if it's there
355359
if (classname in self.cache and nodeid in self.cache[classname]):
@@ -472,7 +476,8 @@ def addjournal(self, classname, nodeid, action, params, creator=None,
472476
the current user.
473477
"""
474478
if __debug__:
475-
logging.getLogger('hyperdb').debug('addjournal %s%s %s %r %s %r'%(classname,
479+
logging.getLogger('roundup.hyperdb').debug(
480+
'addjournal %s%s %s %r %s %r'%(classname,
476481
nodeid, action, params, creator, creation))
477482
if creator is None:
478483
creator = self.getuid()
@@ -482,8 +487,8 @@ def addjournal(self, classname, nodeid, action, params, creator=None,
482487
def setjournal(self, classname, nodeid, journal):
483488
"""Set the journal to the "journal" list."""
484489
if __debug__:
485-
logging.getLogger('hyperdb').debug('setjournal %s%s %r'%(classname,
486-
nodeid, journal))
490+
logging.getLogger('roundup.hyperdb').debug(
491+
'setjournal %s%s %r'%(classname, nodeid, journal))
487492
self.transactions.append((self.doSetJournal, (classname, nodeid,
488493
journal)))
489494

@@ -569,8 +574,8 @@ def pack(self, pack_before):
569574
packed += 1
570575
db[key] = marshal.dumps(l)
571576

572-
logging.getLogger('hyperdb').info('packed %d %s items'%(packed,
573-
classname))
577+
logging.getLogger('roundup.hyperdb').info(
578+
'packed %d %s items'%(packed, classname))
574579

575580
if db_type == 'gdbm':
576581
db.reorganize()
@@ -592,7 +597,7 @@ def commit(self, fail_ok=False):
592597
593598
The only backend this seems to affect is postgres.
594599
"""
595-
logging.getLogger('hyperdb').info('commit %s transactions'%(
600+
logging.getLogger('roundup.hyperdb').info('commit %s transactions'%(
596601
len(self.transactions)))
597602

598603
# keep a handle to all the database files opened
@@ -715,7 +720,7 @@ def doDestroyNode(self, classname, nodeid):
715720
def rollback(self):
716721
""" Reverse all actions from the current transaction.
717722
"""
718-
logging.getLogger('hyperdb').info('rollback %s transactions'%(
723+
logging.getLogger('roundup.hyperdb').info('rollback %s transactions'%(
719724
len(self.transactions)))
720725

721726
for method, args in self.transactions:

roundup/backends/back_postgresql.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def db_create(config):
4242
def db_nuke(config, fail_ok=0):
4343
"""Clear all database contents and drop database itself"""
4444
command = 'DROP DATABASE %s'% config.RDBMS_NAME
45-
logging.getLogger('hyperdb').info(command)
45+
logging.getLogger('roundup.hyperdb').info(command)
4646
db_command(config, command)
4747

4848
if os.path.exists(config.DATABASE):
@@ -131,7 +131,8 @@ def getSessionManager(self):
131131

132132
def sql_open_connection(self):
133133
db = connection_dict(self.config, 'database')
134-
logging.getLogger('hyperdb').info('open database %r'%db['database'])
134+
logging.getLogger('roundup.hyperdb').info(
135+
'open database %r'%db['database'])
135136
try:
136137
conn = psycopg.connect(**db)
137138
except psycopg.OperationalError, message:
@@ -218,15 +219,16 @@ def __repr__(self):
218219
def sql_commit(self, fail_ok=False):
219220
''' Actually commit to the database.
220221
'''
221-
logging.getLogger('hyperdb').info('commit')
222+
logging.getLogger('roundup.hyperdb').info('commit')
222223

223224
try:
224225
self.conn.commit()
225226
except psycopg.ProgrammingError, message:
226227
# we've been instructed that this commit is allowed to fail
227228
if fail_ok and str(message).endswith('could not serialize '
228229
'access due to concurrent update'):
229-
logging.getLogger('hyperdb').info('commit FAILED, but fail_ok')
230+
logging.getLogger('roundup.hyperdb').info(
231+
'commit FAILED, but fail_ok')
230232
else:
231233
raise
232234

roundup/backends/back_sqlite.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,8 @@ def update_class(self, spec, old_spec, force=0, adding_v2=0):
186186
# no changes
187187
return 0
188188

189-
logging.getLogger('hyperdb').info('update_class %s'%spec.classname)
189+
logging.getLogger('roundup.hyperdb').info(
190+
'update_class %s'%spec.classname)
190191

191192
# detect multilinks that have been removed, and drop their table
192193
old_has = {}

roundup/backends/rdbms_common.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ def clear(self):
755755
Note: I don't commit here, which is different behaviour to the
756756
"nuke from orbit" behaviour in the dbs.
757757
"""
758-
logging.getLogger('hyperdb').info('clear')
758+
logging.getLogger('roundup.hyperdb').info('clear')
759759
for cn in self.classes:
760760
sql = 'delete from _%s'%cn
761761
self.sql(sql)
@@ -1063,7 +1063,8 @@ def destroynode(self, classname, nodeid):
10631063
"""Remove a node from the database. Called exclusively by the
10641064
destroy() method on Class.
10651065
"""
1066-
logging.getLogger('hyperdb').info('destroynode %s%s'%(classname, nodeid))
1066+
logging.getLogger('roundup.hyperdb').info('destroynode %s%s'%(
1067+
classname, nodeid))
10671068

10681069
# make sure the node exists
10691070
if not self.hasnode(classname, nodeid):
@@ -1268,7 +1269,7 @@ def pack(self, pack_before):
12681269
def sql_commit(self, fail_ok=False):
12691270
""" Actually commit to the database.
12701271
"""
1271-
logging.getLogger('hyperdb').info('commit')
1272+
logging.getLogger('roundup.hyperdb').info('commit')
12721273

12731274
self.conn.commit()
12741275

@@ -1309,7 +1310,7 @@ def rollback(self):
13091310
Undo all the changes made since the database was opened or the last
13101311
commit() or rollback() was performed.
13111312
"""
1312-
logging.getLogger('hyperdb').info('rollback')
1313+
logging.getLogger('roundup.hyperdb').info('rollback')
13131314

13141315
self.sql_rollback()
13151316

@@ -1324,7 +1325,7 @@ def rollback(self):
13241325
self.clearCache()
13251326

13261327
def sql_close(self):
1327-
logging.getLogger('hyperdb').info('close')
1328+
logging.getLogger('roundup.hyperdb').info('close')
13281329
self.conn.close()
13291330

13301331
def close(self):

scripts/imapServer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
import time
4040

4141
logging.basicConfig()
42-
log = logging.getLogger('IMAPServer')
42+
log = logging.getLogger('roundup.IMAPServer')
4343

4444
version = '0.1.2'
4545

test/db_test_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def tearDown(self):
128128
from roundup import rlog
129129
config.logging = rlog.BasicLogging()
130130
config.logging.setLevel(os.environ['LOGGING_LEVEL'])
131-
config.logging.getLogger('hyperdb').setFormat('%(message)s')
131+
config.logging.getLogger('roundup.hyperdb').setFormat('%(message)s')
132132

133133
class DBTest(MyTestCase):
134134
def setUp(self):

0 commit comments

Comments
 (0)