[PEAK] peak.running.logging
Victor Ng
victor at gap.ca
Thu Nov 27 15:27:48 EST 2003
Hey everyone,
I'm still playing around with PEAK - it's giving me flashbacks to
learning how to use vim or emacs - the learning curve is pretty steep,
but every hurdle I get over seems to bring a little 'Aha!' moment. :)
I've think I've got a basic understanding of the peak.model.elements
and peak.model.features - at least the bits that are covered by the
bulletins tutorial. I can now get domain objects to pop out of my data
managers - so that's good.
I'm having a bit of a tough time figuring out what's going on with the
peak.running.logs though. How do I go about customizing the log
messages?
In particular when I do something like this:
log = binding.Obtain('logging.logger:storage.AddContact')
Where does the "storage.AddContact" go? In fact, what is it used for?
I was under the impression that it's a logical name for a logger and it
should show up in the log messages.
I was expecting something like this:
Nov 27 14:20:51 dhcp139 storage.AddContact [3926]: Creating
sqlite:///tmp/sextant.db using DDL from
/Users/victorng/dev/sextant/src/sextant/sqlite-ddl.sql
instead of :
Nov 27 14:20:51 dhcp139 PEAK [3926]: Creating sqlite:///tmp/sextant.db
using DDL from /Users/victorng/dev/sextant/src/sextant/sqlite-ddl.sql
I've also tried subclassing the peak.running.logs.LogFile class and
changing the publish method, but I"m not sure how to get peak.logs to
use my custom logfile logger. Here's what I've put in my initial
configuration (based on the bulletins example).
[peak.logs]
* = sextant.logs.SextantLogFile(filename='/usr/local/log/sextant.log',
level=logs.DEBUG)
The above throws an error saying "sextant" is undefined - how do I
declare an import using the config files? Or am I running in
completely the wrong direction here? It feels like I'm doing something
horribly wrong.
My ultimate goal would be to have a logger that takes in a couple
arguments so that I can get event records with event ID numbers in the
log. Something like this:
2003-11-27 14:20:51,dhcp139,storage.AddContact,555,777,"Creating
sqlite:///tmp/sextant.db using DDL from
/Users/victorng/dev/sextant/src/sextant/sqlite-ddl.sql"
where 555 and 777 are status code passed in when call the logging
system.
vic
More information about the PEAK
mailing list