Closed clyra closed 9 years ago
That should be part of the logging
module that is included in the standard Python installation. Does the following script work (paste this in an interactive shell, just start python
from the command line)?
import logging
logging.basicConfig(format="%(asctime)s - %(levelname)-7s :: %(threadName)s : %(message)s")
logging.getLogger().error("You should see this error message being printed.")
Hi.
Sorry for the slow reply. Same error:
Python 2.7.9 (default, Mar 1 2015, 12:57:24) [GCC 4.9.2] on linux2 Type "help", "copyright", "credits" or "license" for more information.
import logging logging.basicConfig(format="%(asctime)s - %(levelname)-7s :: %(threadName)s : %(message)s") logging.getLogger().error("You should see this error message being printed.") Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/logging/init.py", line 723, in emit msg = self.format(record) File "/usr/local/lib/python2.7/dist-packages/logging/init.py", line 609, in format return fmt.format(record) File "/usr/local/lib/python2.7/dist-packages/logging/init.py", line 402, in format s = self._fmt % record.dict KeyError: 'threadName'
But... I also tried that script on another debian machine, and it worked. So my python install should be broken. I wil try to reinstall it. You will close the ticket, my bad :-(.
Hi,
After a upgrade, headphones no longer starts. Here is the log:
~/headphones$ python Headphones.py Traceback (most recent call last): File "Headphones.py", line 223, in
main()
File "Headphones.py", line 155, in main
headphones.initialize(config_file)
File "/home/baixador/headphones/headphones/init.py", line 155, in initialize
logger.info('Checking to see if the database has all tables....')
File "/usr/local/lib/python2.7/dist-packages/logging/init.py", line 955, in info
apply(self._log, (INFO, msg, args), kwargs)
File "/usr/local/lib/python2.7/dist-packages/logging/init.py", line 1062, in _log
self.handle(record)
File "/usr/local/lib/python2.7/dist-packages/logging/init.py", line 1072, in handle
self.callHandlers(record)
File "/usr/local/lib/python2.7/dist-packages/logging/init.py", line 1105, in callHandlers
hdlr.handle(record)
File "/usr/local/lib/python2.7/dist-packages/logging/init.py", line 634, in handle
self.emit(record)
File "/home/baixador/headphones/headphones/logger.py", line 51, in emit
headphones.LOG_LIST.insert(0, (helpers.now(), message, record.levelname, record.threadName))
AttributeError: LogRecord instance has no attribute 'threadName'
The system is a Debian stable with python version 2.7.