-
-
Notifications
You must be signed in to change notification settings - Fork 680
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
Weasyprint logging is missconfigured #412
Comments
For those hitting this problem before it's fixed, here's how I've disabled the weasyprint logging handler - the logger needs to be set up before the first import of weasyprint
|
Version 0.39 ------------ Released on 2017-06-24. Bug fixes: * Fix the use of WeasyPrint's URL fetcher with CairoSVG. Version 0.38 ------------ Released on 2017-06-16. Bug fixes: * `#477 <https://github.com/Kozea/WeasyPrint/issues/477>`_: Don't crash on font-face's src attributes with local functions. Version 0.37 ------------ Released on 2017-06-15. WeasyPrint now depends on tinycss2 instead of tinycss. New features: * `#437 <https://github.com/Kozea/WeasyPrint/issues/437>`_: Support local links in generated PDFs. Bug fixes: * `#412 <https://github.com/Kozea/WeasyPrint/issues/412>`_: Use a NullHandler log handler when WeasyPrint is used as a library. * `#417 <https://github.com/Kozea/WeasyPrint/issues/417>`_, `#472 <https://github.com/Kozea/WeasyPrint/issues/472>`_: Don't crash on some line breaks. * `#327 <https://github.com/Kozea/WeasyPrint/issues/327>`_: Don't crash with replaced elements with height set in percentages. * `#467 <https://github.com/Kozea/WeasyPrint/issues/467>`_: Remove incorrect line breaks. * `#446 <https://github.com/Kozea/WeasyPrint/pull/446>`_: Let the logging module do the string interpolation.
If you want to use Weasyprint under django, you can configure weasyprint's logger via django, but this setting never is set
This hack doesn't work for Django applications. Neither in the settings.py nor before the import of the library. Use this instead:
|
For those who use Django internal LOGGING dict-like config: LOGGING = {
'version': 1,
...
'handlers': {
...
'null_handler': {
'level': 'ERROR',
'class': 'logging.NullHandler',
},
},
'loggers': {
...
'weasyprint': {
'level': 'ERROR',
'handlers': ['null_handler'],
},
}
} |
Using
I was still getting log messages such as
Salient points:
|
From the python docs https://docs.python.org/2/howto/logging.html#library-config :
The default handler should be the NullHandler.
The text was updated successfully, but these errors were encountered: