Log Config example for SMTPHandler

33 views
Skip to first unread message

C Vora

unread,
Aug 26, 2008, 5:44:42 PM8/26/08
to TurboGears
Hi all

I'm still getting acquinted with the Python in general and the logging
module in particular. After flailing around initially, I managed to
get my way around logging in Turbogears using the FileHandler and the
standard outputs (I concur with one of the earlier posts here that the
Turbogears documentation is vague at best and pretty confusing at
worst...and no, I am not new to log4j and come from the Java world
but still found the documentation incomplete.)

Anyways, I was trying to set up an SMTPHandler to be able to send
error messages to an email. I thought I'd set that up using the same
way I set up the FileHandler but with different arguments. Well, I get
parser error when doing that. Here is my attempt:

[[loggers]]
[[[my_app]]]
qualname='my_app'
level='DEBUG'
handlers=['mydebug_out','myerror_out']

[[handlers]]
[[[mydebug_out]]]
level='DEBUG'
args="('debug.log',)"
class='FileHandler'
formatter='full_content'

[[[myerror_out]]]
level='ERROR'
class='SMTPHandler' (also tried handlers.SMTPHandler)
args="('xx.yy.com','mya...@yy.com',['m...@yy.com'],"App Error Log',)"
formatter='full_content'


The intention is to send all log output (DEBUG and above) to debug.log
and email all ERROR logs to a given email.

The above gives this error:
File "./start-rbuls.py", line 20, in <module>
modulename="rbuls.config")
File "/usr/lib/python2.5/site-packages/TurboGears-1.0.4.4-py2.5.egg/
turbogears/config.py", line 206, in update_config
configdict = config_obj(configfile, modulename).dict()
File "/usr/lib/python2.5/site-packages/TurboGears-1.0.4.4-py2.5.egg/
turbogears/config.py", line 192, in config_obj
configdata2 = ConfigObj(configfile, unrepr=True)
File "/usr/lib/python2.5/site-packages/configobj-4.5.2-py2.5.egg/
configobj.py", line 1272, in __init__
File "/usr/lib/python2.5/site-packages/configobj-4.5.2-py2.5.egg/
configobj.py", line 1355, in _load
configobj.UnreprError: Parse error in value at line 109.


Any ideas? Is SMTPHandler unsupported in Turbogears? Any pointers or a
working config file would be of great help.

TIA,
C Vora

Jorge Vargas

unread,
Aug 26, 2008, 11:17:36 PM8/26/08
to turbo...@googlegroups.com
On Tue, Aug 26, 2008 at 3:44 PM, C Vora <cheta...@gmail.com> wrote:
>
> Hi all
>
you have a syntax error on your config file.

>
> [[[myerror_out]]]
> level='ERROR'
> class='SMTPHandler' (also tried handlers.SMTPHandler)
> args="('xx.yy.com','mya...@yy.com',['m...@yy.com'],"App Error Log',)"
> formatter='full_content'
>

"App Error Log' should be 'App Error Log'

C Vora

unread,
Aug 27, 2008, 9:41:00 AM8/27/08
to TurboGears
Ooops...I feel stupid now...it was a long day [blush]. Thanks!

On Aug 26, 11:17 pm, "Jorge Vargas" <jorge.var...@gmail.com> wrote:
> On Tue, Aug 26, 2008 at 3:44 PM, C Vora <chetanv...@gmail.com> wrote:
>
> > Hi all
>
> you have a syntax error on your config file.
>
>
>
> > [[[myerror_out]]]
> > level='ERROR'
> > class='SMTPHandler' (also tried handlers.SMTPHandler)
> > args="('xx.yy.com','mya...@yy.com',['...@yy.com'],"App Error Log',)"
Reply all
Reply to author
Forward
0 new messages