now allowing python_logging.yaml#1033
Conversation
|
FYI @paulbovbel |
|
@mikepurvis yes just that. I figured it was simple enough to add and would allow more detailed configuration using recent python 2.7 logging API. Plus we are already using yaml everywhere for configuration in our ROS software so why not for logging as well. But AFAIK there is no test for this behaviour it and I haven't used it yet, so this patch might need a few days/weeks to mature... |
|
I tested part of that new code (by setting ---
version: 1
disable_existing_loggers: False
formatters:
default:
format: "[%(name)s][%(levelname)s] %(asctime)s: %(message)s"
handlers:
rosconsole:
class: rosgraph.roslogging.RosStreamHandler
level: DEBUG
formatter: default
colorize: True
roslog:
class: logging.handlers.RotatingFileHandler
level: DEBUG
formatter: default
filename: os.environ['ROS_LOG_FILENAME']
maxBytes: 50000000
backupCount: 4
loggers:
root:
level: INFO
handlers: [roslog]
rosout:
level: INFO
handlers: [rosconsole]
propagate: yes
qualname: rosout
I get one error that I didn't have with python_logging.conf : As well as for my other custom loggers in my code that didn't add So I understand it means that no logger is configured for We should add a |
|
Or maybe we do not want a And we should define (for example) :
Any idea/advice for this ? |
|
I solved roslaunch warning on my side by adding this to the config : |
| dict_conf = yaml.load(f) | ||
| dict_conf.setdefault('version', 1) | ||
| logging.config.dictConfig(dict_conf) | ||
|
|
There was a problem hiding this comment.
Currently this block doesn't have an else part. Also if the user was using a different filename before it might not work with the modified code anymore. Therefore I would suggest the logic to be updated to:
if yaml:
# do yaml stuff
else:
# do stuff as before
dirk-thomas
left a comment
There was a problem hiding this comment.
Please retarget the latest development branch (lunar-devel).
| import logging | ||
| import logging.config | ||
|
|
||
| import yaml |
There was a problem hiding this comment.
The package currently doesn't depend on yaml. Please add the additional dependency to the package manifest.
There was a problem hiding this comment.
There was a problem hiding this comment.
Ah I get it now rosgraph, not roslaunch. my bad...
…ed yaml dependency
Small PR to enable support for yaml configuration for python logging.
Do not merge yet, this is still in testing...