-
Notifications
You must be signed in to change notification settings - Fork 3
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
Fix parsing of the ini file to setup sqlalchemylogger #2297
Conversation
Why don't use the |
To be more clear, logging try to instantiate the c2cwsgiutils.handlers.sqlalchemy handler with only one argument: |
Reading the code (and the doc) of |
ad72f4a
to
56e1bd8
Compare
Code updated using kwargs now. |
ee4ca39
to
a7fdc19
Compare
Everything works now. And everythings' documented here I think. I don't need a I don't know the issue with the CI here. |
@ger-benjamin Thanks :-) To fix the CI error, running |
Done for sqlalchemylogger, but actually the logger would try to write logs (process) on another process than the logs collecteur (emit) which can't work. The setup of sqlalchemy logger must be done manually in the project and not via the ini file.
c9a93d5
to
8cdd48e
Compare
8cdd48e
to
ca728e7
Compare
Hi @sbrunner
We are using this sqlalchemy logger in a project using c2cwsgiutils 1.4. It was working well.
And now, I try to upgrade to c2cwsgiutils 6.0.8, and I can't make it work.
This (draft) PR is open to discussion, and solves already somme issue related to the
.ini
file, and the way c2cwsgiutils parses it.The example propose this config for the
.ini
file.:First, the args is wrong I think. I had to add a final comma, otherwise I get an error.
With the current code, the
args
here will become astream
property, like that:It's valid for console, or JSON built-in handlers, but te sqlalchemy doesn't expect a stream. It expect a
sqlalchem_url
, adoes_not_contain_expression
and acontains_expression
parameters.I can't makes it work with the current python and the
args
(orkwargs
) property. I've tried, even by chnaging the code and passingargs
instead ofstream
, but it doesn't work. So, I've adapted the code here to haveclass_args_
properties.I think that's also more clear to use
class_args_stream
instead ofargs
that becomesstream
.One other tweaks I add to do is to change the "handlers" parsing. The current code give returns a String with
handlers: console, json
. Now, it returns an array:handlers: ['console', 'json']
.With these change, I can starts to use the sqlalchemy parser. But here is still an issue between the
emit
and the process that write the log into the DB. But this part is magic, I'll need to discuss about this with you.To do:
class_args_
toclass_arg_
=> use kwargs instead, and ban argsNew to do:
stream
askwargs
See also: https://docs.python.org/3/library/logging.config.html