Repository navigation
Use a default StreamHandler for all loggers - #623
dhirschfeld wants to merge 4 commits into
Conversation
dhirschfeld
commented
Nov 2, 2016
- Remove use of basicConfig which can affect the root logger
- Remove use of basicConfig which can affect the root logger
|
The stream handler apparently isn't dumping out to stdout, hence the error. |
| import logging | ||
| from .compatibility import logging_names | ||
| logging.basicConfig(format='%(name)s - %(levelname)s - %(message)s', | ||
| level=logging.INFO) |
There was a problem hiding this comment.
I wonder if another option might be logging.getLogger('distributed').basicConfig(...)
There was a problem hiding this comment.
AFAICS it's not a method on a logging instance?
There was a problem hiding this comment.
Oh well. Hrm, perhaps this is intended to be global and you're expected to just overwrite other people? Perhaps call basicConfig yourself after importing dask.distributed?
My next step here would be to ask on stackoverflow what the right way to do this would be.
There was a problem hiding this comment.
basicConfig or any other global logging configuration is discouraged in libraries. I think configuring only our own loggers is fine.
|
The builds which failed all seemed to hang on |
|
The |
|
I tried passing |
|
@dhirschfeld, you can probably install bokeh and run the tests locally if you don't want to wait for Travis every time. |
| fmt = logging.Formatter('%(name)s - %(levelname)s - %(message)s') | ||
| handler.setFormatter(fmt) | ||
|
|
||
| for name, level in config.get('logging', {}).items(): |
There was a problem hiding this comment.
By default, this won't configure any logger, though? You should add a default configuration for the "distributed" logger, it will be inherited by any child loggers (any "distributed.FOO.BAR").
There was a problem hiding this comment.
This just configures a handler which is then applied to each logger in the loop below.
This is done instead of setting a handler on the root logger (with basicConfig) and letting the distributed logs percolate up.
There was a problem hiding this comment.
My point is it doesn't configure any logger if you have nothing in the logging configuration.
There was a problem hiding this comment.
Right, you probably wouldn't ever want all output to be silenced. I'm assuming that the test is failing because no loggers are configured so I've pushed a further change to fall back to basicConfig in that instance. We'll see what travis thinks of that...
I've just been using the GitHub web-interface so its easier for me to simply wait for travis. I can squash the commits if desired when the test pass.
| logger.addHandler(handler) | ||
|
|
||
| # http://stackoverflow.com/questions/21234772/python-tornado-disable-logging-to-stderr | ||
| stream = logging.StreamHandler(sys.stderr) |
There was a problem hiding this comment.
Logging only critical messages seems heavy-handed. This will even silence exceptions when add_callback callbacks are called. I would recommend setting the level to ERROR instead.
There was a problem hiding this comment.
Or at least we should enable errors on the "tornado.application" logger: see http://www.tornadoweb.org/en/stable/log.html
|
@dhirschfeld, if you are struggling with this PR, do you want me to take over? |
|
Please do! I'm at a bit of a loss as to how to both solve my problem and There's not too much here so if it's easier to close this and start afresh On 10 Nov 2016 1:24 am, "Antoine Pitrou" [email protected] wrote:
|
|
I'm going close this PR as obsoleted by #645. |