The logging FAQ states "Therefore, when using Python logging, ensure
all echo flags are set to False at all times, to avoid getting
duplicate log lines."
http://www.sqlalchemy.org/docs/dbengine.html#configuring-logging

Is this no longer correct information?

I am using turbogears (which creates the engine with
engine_from_config()) and with the config file like this:

sqlalchemy.echo = false
sqlalchemy.echo_pool = false
sqlalchemy.pool_recycle = 3600

I cannot get engine logging no matter what I put in the logging config
file.  echo is turned off and sqlalchemy won't even hit the
logger.debug() method.

If I try:

sqlalchemy.echo = true

then I cannot get DEBUG level no matter what level is specified in the
logging config file (but can get INFO)

If I try:
sqlalchemy.echo = debug

I get this:
  File "/home/rarch/tg2env/lib/python2.6/site-packages/
TurboGears2-2.0.1.1kb-py2.6.egg/tg/configuration.py", line 390, in
setup_sqlalchemy
    engine = engine_from_config(pylons_config, 'sqlalchemy.')
  File "/home/rarch/tg2env/lib/python2.6/site-packages/
SQLAlchemy-0.6.3.2dev-py2.6-linux-x86_64.egg/sqlalchemy/engine/
__init__.py", line 259, in engine_from_config
    opts = _coerce_config(configuration, prefix)
  File "/home/rarch/tg2env/lib/python2.6/site-packages/
SQLAlchemy-0.6.3.2dev-py2.6-linux-x86_64.egg/sqlalchemy/engine/
__init__.py", line 280, in _coerce_config
    util.coerce_kw_type(options, option, type_)
  File "/home/rarch/tg2env/lib/python2.6/site-packages/
SQLAlchemy-0.6.3.2dev-py2.6-linux-x86_64.egg/sqlalchemy/util.py", line
562, in coerce_kw_type
    kw[key] = asbool(kw[key])
  File "/home/rarch/tg2env/lib/python2.6/site-packages/
SQLAlchemy-0.6.3.2dev-py2.6-linux-x86_64.egg/sqlalchemy/util.py", line
551, in asbool
    raise ValueError("String is not true/false: %r" % obj)
ValueError: String is not true/false: 'debug'


**** by the way, that seems like a bug.  If 'debug' is allowed for
echo, then why is asbool() invoked?


The only way I could get this to work is by commenting out the echo
specification entirely:
#sqlalchemy.echo =
sqlalchemy.echo_pool = false
sqlalchemy.pool_recycle = 3600

Only now can the logging config sections have a chance to set the
logging level to DEBUG or INFO.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to