-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
log-config-dict cli option is broken, can't work as coded. #1909
Comments
what error do you have? how to reproduce it? |
Just try starting gunicorn with the
There's no way to pass a python dict from the shell. You can only pass a string, and the code in gunicorn isn't setup to do the conversion from the string representation of the dict to the python dict object. |
afaik i'm not sure what is expected to pass on the command line there. Giving a dict as a string seems odd. cc @berkerpeksag @tilgovi |
It seems like something like a json-encoded dict should be accepted:
|
I think In any case, we need to improve the |
By the way, the following configuration file worked for me: logconfig_dict = {
'formatters': {
'verbose': {
'format': 'XXX %(levelname)s %(process)d %(asctime)s %(name)s %(pathname)s:%(lineno)d %(message)s',
},
'generic': {
'format': '%(asctime)s [%(process)d] [%(levelname)s] %(message)s',
'datefmt': '[%Y-%m-%d %H:%M:%S %z]',
},
},
'handlers': {
'console': {
'class': 'logging.StreamHandler',
'formatter': 'verbose',
},
'error_console': {
'class': 'logging.StreamHandler',
'formatter': 'generic',
'stream': 'ext://sys.stderr',
},
},
'version': 1,
'disable_existing_loggers': False,
} It can be tested as follows: $ cd gunicorn/examples
$ gunicorn -c ../conf.py test:app |
so I suggest either of these options
|
i would go for (1) , can you provide a PR for it? |
In the version |
There is no support for decoding any dictionary supplied on the command line. The only way to supply a dictionary logging config is through the configuration file. Close #1909.
There is no support for decoding any dictionary supplied on the command line. The only way to supply a dictionary logging config is through the configuration file. Close #1909.
There is no support for decoding any dictionary supplied on the command line. The only way to supply a dictionary logging config is through the configuration file. Close benoitc#1909.
Despite #1880 being closed, the
--log-config-dict
cli option is broken and can't work as coded because the CLI'stype
member isn't set, so the dict_validator tries to validate a string (what's coming from ARGV), unconverted, and that fails.I tried hacking the code to use
type = json.loads
so that the string would be converted to a dict by ArgParse, but couldn't make that work either. (I think that can work, I was just screwing something up I'm guessing).The text was updated successfully, but these errors were encountered: