Merge lp:~chipaca/ubuntuone-client/fix-u1frefs-logging into lp:ubuntuone-client

Proposed by John Lenton
Status: Merged
Approved by: John O'Brien
Approved revision: 438
Merged at revision: not available
Proposed branch: lp:~chipaca/ubuntuone-client/fix-u1frefs-logging
Merge into: lp:ubuntuone-client
Diff against target: 32 lines (+9/-5)
1 file modified
bin/ubuntuone-preferences (+9/-5)
To merge this branch: bzr merge lp:~chipaca/ubuntuone-client/fix-u1frefs-logging
Reviewer Review Type Date Requested Status
John O'Brien (community) Approve
dobey (community) Approve
Review via email: mp+21597@code.launchpad.net

Commit message

Fix the logging in ubuntuone-preferences to work correctly

Description of the change

A very small branch that applies suggestions by verterok as to how to get logging working with minimal fuss. fixes #540466.

To post a comment you must log in.
Revision history for this message
dobey (dobey) :
review: Approve
Revision history for this message
John O'Brien (jdobrien) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/ubuntuone-preferences'
2--- bin/ubuntuone-preferences 2010-03-17 13:53:37 +0000
3+++ bin/ubuntuone-preferences 2010-03-17 21:52:41 +0000
4@@ -32,7 +32,8 @@
5 from oauth import oauth
6 from ubuntuone import clientdefs
7 from ubuntuone.syncdaemon.tools import SyncDaemonTool
8-from ubuntuone.syncdaemon.logger import LOGFOLDER
9+from ubuntuone.syncdaemon.logger import (basic_formatter, LOGFOLDER,
10+ CustomRotatingFileHandler)
11
12 import logging
13 import httplib, urlparse, socket
14@@ -41,11 +42,14 @@
15 from dbus.exceptions import DBusException
16 from dbus.mainloop.glib import DBusGMainLoop
17
18-logging.basicConfig(
19- filename=os.path.join(LOGFOLDER, 'u1-prefs.log'),
20- level=logging.DEBUG,
21- format="%(asctime)s - %(name)s - %(levelname)s - %(message)s")
22 logger = logging.getLogger("ubuntuone-preferences")
23+logger.setLevel(logging.DEBUG)
24+handler = CustomRotatingFileHandler(filename=os.path.join(LOGFOLDER,
25+ 'u1-prefs.log'))
26+handler.setFormatter(basic_formatter)
27+handler.setLevel(logging.DEBUG)
28+logger.addHandler(handler)
29+
30 DBusGMainLoop(set_as_default=True)
31
32 _ = gettext.gettext

Subscribers

People subscribed via source and target branches