brandon-rhodes / logging_tree Goto Github PK
View Code? Open in Web Editor NEWDebug Python logging problems by printing out the tree of handlers you have defined.
License: BSD 2-Clause "Simplified" License
Debug Python logging problems by printing out the tree of handlers you have defined.
License: BSD 2-Clause "Simplified" License
Some nodes show up as:
o "pywiki"
others show up as
o<--"requests"
I'm assuming the ones with a left-pointing arrow are where propagate is True, and the ones with no arrow are where propagate is False? Assuming that's correct, it should be added to the documentation.
Hello and thanks for developing logging-tree.
Does it support Python 3.8? I'm running into an error in the tests:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=948974
From the docs
The term ‘delegation to the parent’ means that if a logger has a level of NOTSET, its chain of ancestor loggers is traversed until either an ancestor with a level other than NOTSET is found, or the root is reached.
If an ancestor is found with a level other than NOTSET, then that ancestor’s level is treated as the effective level of the logger where the ancestor search began, and is used to determine how a logging event is handled.
It would be useful to present this information in some form.
It would be very helpful if you could tag releases as well. This would enable distributions to fetch the package from GitHub instead of Pypi, where not all files are included.
Thanks
I'm getting this warning but I'm not sure what to do about it:
o !-"basic"
| Broken .parent! Messages propagate to "celery.task"
| Level NOTSET so inherits level INFO
| Handler <kombu.log.NullHandler object at 0x7f67b630a2e8>
There is an (undocumented, AFAICT) property on the loggers called parent
. This points to the parent logger, skipping missing loggers up the chain.
Celery uses this property in an interesting way. The get_task_logger
function overrides that parent
attribute, so that those loggers will inherit its formatters (which add some nice, useful context about the worker the log was written from, what task was running, etc). Unfortunately, it meant that I saw some very strange behavior from this tool, which assumes that the parent logger will always be something from the beginning of the current logger.
Hi,
would you consider adding documentation to the repository - maybe a copy of http://rhodesmill.org/brandon/2012/logging_tree/ ?
A docs/ directory with Sphinx .rst / .md files would be ideal.
Do you accept patches?
Curious!
--- SOURCES/logging_tree-1.1 » python3 -m unittest discover logging_tree
....EEEE...
======================================================================
ERROR: test_2_dot_5_handlers (tests.test_format.FormatTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/threebean/rpmbuild/SOURCES/logging_tree-1.1/logging_tree/tests/test_format.py", line 137, in test_2_dot_5_handlers
ah(logging.handlers.TimedRotatingFileHandler('/bar/two.txt'))
File "/usr/lib64/python3.3/logging/handlers.py", line 203, in __init__
BaseRotatingHandler.__init__(self, filename, 'a', encoding, delay)
File "/usr/lib64/python3.3/logging/handlers.py", line 58, in __init__
logging.FileHandler.__init__(self, filename, mode, encoding, delay)
File "/usr/lib64/python3.3/logging/__init__.py", line 965, in __init__
StreamHandler.__init__(self, self._open())
File "/usr/lib64/python3.3/logging/__init__.py", line 987, in _open
return open(self.baseFilename, self.mode, encoding=self.encoding)
TypeError: __init__() got an unexpected keyword argument 'encoding'
======================================================================
ERROR: test_2_dot_6_handlers (tests.test_format.FormatTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/threebean/rpmbuild/SOURCES/logging_tree-1.1/logging_tree/tests/test_format.py", line 148, in test_2_dot_6_handlers
ah(logging.handlers.WatchedFileHandler('/bar/three.txt'))
File "/usr/lib64/python3.3/logging/handlers.py", line 421, in __init__
logging.FileHandler.__init__(self, filename, mode, encoding, delay)
File "/usr/lib64/python3.3/logging/__init__.py", line 965, in __init__
StreamHandler.__init__(self, self._open())
File "/usr/lib64/python3.3/logging/__init__.py", line 987, in _open
return open(self.baseFilename, self.mode, encoding=self.encoding)
TypeError: __init__() got an unexpected keyword argument 'encoding'
======================================================================
ERROR: test_fancy_tree (tests.test_format.FormatTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/threebean/rpmbuild/SOURCES/logging_tree-1.1/logging_tree/tests/test_format.py", line 78, in test_fancy_tree
log.addHandler(logging.FileHandler('/foo/log.txt'))
File "/usr/lib64/python3.3/logging/__init__.py", line 965, in __init__
StreamHandler.__init__(self, self._open())
File "/usr/lib64/python3.3/logging/__init__.py", line 987, in _open
return open(self.baseFilename, self.mode, encoding=self.encoding)
TypeError: __init__() got an unexpected keyword argument 'encoding'
======================================================================
ERROR: test_most_handlers (tests.test_format.FormatTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/threebean/rpmbuild/SOURCES/logging_tree-1.1/logging_tree/tests/test_format.py", line 107, in test_most_handlers
'/bar/one.txt', maxBytes=10000, backupCount=3))
File "/usr/lib64/python3.3/logging/handlers.py", line 151, in __init__
BaseRotatingHandler.__init__(self, filename, mode, encoding, delay)
File "/usr/lib64/python3.3/logging/handlers.py", line 58, in __init__
logging.FileHandler.__init__(self, filename, mode, encoding, delay)
File "/usr/lib64/python3.3/logging/__init__.py", line 965, in __init__
StreamHandler.__init__(self, self._open())
File "/usr/lib64/python3.3/logging/__init__.py", line 987, in _open
return open(self.baseFilename, self.mode, encoding=self.encoding)
TypeError: __init__() got an unexpected keyword argument 'encoding'
----------------------------------------------------------------------
Ran 11 tests in 0.002s
FAILED (errors=4)
Handlers (in addition to loggers) can also have logging level set. It would be handy to have these levels being shown.
Some formatters don't have a _fmt
attribute (for example, the LogstashFormatterVersion1
from python-logstash). Logging_tree shouldn't assume that all formatters have a format string.
(Excellent tool otherwise, thanks!)
Hi this excellent piece of software has solved me lots of times, just listing out the hierarchy tells me what is wrong and not.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.