Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <mpg@redhat.com>2007-10-09 20:16:28 (GMT)
committer Marco Pesenti Gritti <mpg@redhat.com>2007-10-09 20:16:28 (GMT)
commite60ee34dc4b9e97aedebb746a0a86fbc12ed14ca (patch)
treef156b2865901487a20328b0c237dcfba44a284ed /bin
parentebd5a33c5aa08af8bb2dfcc78bb2717fca4711dc (diff)
Use cut/pasted sugar logger initialization, so
that we get consistent logs and tracebacks are logged too.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/datastore-service21
1 files changed, 6 insertions, 15 deletions
diff --git a/bin/datastore-service b/bin/datastore-service
index 758ca45..1a62dfc 100755
--- a/bin/datastore-service
+++ b/bin/datastore-service
@@ -3,7 +3,7 @@ import sys, os, signal
import gobject
import dbus.service
import dbus.mainloop.glib
-from olpc.datastore import DataStore, DS_LOG_CHANNEL, backingstore
+from olpc.datastore import DataStore, backingstore, logger
import logging
# Path handling
@@ -20,16 +20,7 @@ if not os.path.exists(log_dir): os.makedirs(log_dir)
#os.chdir(repo_dir)
# setup logger
-filename = None
-if not sys.stdin.isatty():
- filename = os.path.join(log_dir, "datastore.log")
-
-logging.basicConfig(level=logging.WARNING,
- format="%(asctime)-15s %(levelname)s: %(message)s",
- filename = filename,
- )
-# disable subsystem logging except where critical
-logger = logging.getLogger(DS_LOG_CHANNEL)
+logger.start('datastore')
# check for old lockfiles, the rules here are that we can't be
# connected to a tty. If we are not then in all likelyhood the process
@@ -51,7 +42,7 @@ ds.registerBackend(backingstore.FileBackingStore)
ds.registerBackend(backingstore.InplaceFileBackingStore)
# and run it
-logger.info("Starting Datastore %s" % (repo_dir))
+logging.info("Starting Datastore %s" % (repo_dir))
mainloop = gobject.MainLoop()
def handle_disconnect():
@@ -91,10 +82,10 @@ def main():
time.sleep(0.0025)
except KeyboardInterrupt:
- logger.info("DataStore shutdown by user")
+ logging.info("DataStore shutdown by user")
except:
- logger.debug("Datastore shutdown with error",
- exc_info=sys.exc_info())
+ logging.debug("Datastore shutdown with error",
+ exc_info=sys.exc_info())
main()