LoggingLogHandler namespace causes issues #211

Closed
derks opened this Issue Nov 6, 2013 · 1 comment

Comments

Projects
None yet
1 participant
@derks
Member

derks commented Nov 6, 2013

This is a continuation of another bug in Issue #191. When an app built on cement uses another library that uses logger, the other library blows up because of the 'namespace' used in Cement LoggingLogHandler format strings.

The following is a result of using Cement with Flask:

Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/__init__.py", line 851, in emit
    msg = self.format(record)
  File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/__init__.py", line 724, in format
    return fmt.format(record)
  File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/__init__.py", line 467, in format
    s = self._fmt % record.__dict__
KeyError: 'namespace'

The above is resolved by overriding the format string when creating the LoggingLogHandler instance:

log_handler = LoggingLogHandler(debug_format = "%(asctime)s (%(levelname)s) : %(message)s")

@ghost ghost assigned derks Nov 6, 2013

derks added a commit that referenced this issue Jan 27, 2014

@derks derks closed this Jan 27, 2014

@derks

This comment has been minimized.

Show comment
Hide comment
@derks

derks Feb 20, 2014

Member

Eh, this fix looks ugly in --debug:

2014-02-19 18:23:16,832 (DEBUG) helloworld:None : logging initialized for 'helloworld:None' using LoggingLogHandler
Member

derks commented Feb 20, 2014

Eh, this fix looks ugly in --debug:

2014-02-19 18:23:16,832 (DEBUG) helloworld:None : logging initialized for 'helloworld:None' using LoggingLogHandler

@derks derks reopened this Feb 20, 2014

@derks derks modified the milestones: 2.2.2 Stable, 2.2.0 Stable Feb 20, 2014

derks added a commit that referenced this issue Apr 15, 2014

@derks derks closed this Apr 15, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment