[PEAK] peak logs

Phillip J. Eby pje at telecommunity.com
Fri Jan 2 19:33:35 EST 2004


At 10:04 AM 1/2/04 -0800, darryl wrote:
>Ok,
>
>I'm still confused.
>
>Here is my .ini file as it stands:
>
>[peak.logs]
>* = logs.LogStream(stream=importString('sys.stderr'),level=logs.DEBUG)
>bot.jabber  = logs.LogStream(stream=importString('sys.stderr'),levelName = 
>"DEBUG")
>
>Now in my class i'm doing like so:
>
>    log   = binding.Obtain('logger:bot.jabber',
>offerAs=['app.log'])
>
>if i do:
>print self.log
>i get:
><peak.running.logs.LogStream object at 0x83d9944>

Try 'print self.log.level'.


>however when i do:
>
>self.log.debug("some test output")
>
>i don't get any output. I must be missing something here :)

Again, try it in the interpreter.  If it works in the interpreter, the 
problem's in your program, not your configuration.  :)

The next thing to do is to create an instance of your class in the 
interpreter and try that.  E.g.:

 >>> from peak.api import *
 >>> from myapp import MyBrokenClass
 >>> ob = MyBrokenClass(config.makeRoot())
 >>> ob.log.debug("foo")

If the problem is that you're offering the log in one place, and another 
place doesn't seem to be getting it, then you need to do a few more steps 
here, but that's the basic idea.




More information about the PEAK mailing list