wkhtmltopdf writes in apache error log for every pdf created

China☆狼群 提交于 2020-01-06 03:31:07

问题


Every time a PDF is created in WKHTMLTOPDF (using php) i am getting the following in the apache error log:

Loading pages (1/6)
[>                                                           ] 0%
[======>                                                     ] 10%
[==========>                                                 ] 17%
[===================>                                        ] 32%
[==============================>                             ] 50%
[=====================================>                      ] 63%
[============================================>               ] 74%
[============================================================] 100%
Counting pages (2/6)                                               
[============================================================] Object 1 of 1
Resolving links (4/6)                                                       
[============================================================] Object 1 of 1
Loading headers and footers (5/6)                                           
Printing pages (6/6)
[>                                                           ] Preparing
[============================================================] Page 1 of 1
Done                                                                      

However the pdf is created without any errors, is there a way of stopping this as the error logs are getting very large and also masking genuine errors?

Thanks


回答1:


To silence wkhtmltopdf specifically:

  1. Use the --quiet flag:

     exec("wkhtmltoimage -q …");
    
  2. And redirect stderr per 2>/dev/null or similar shell features:

     exec("wkhtmltopdf -q … 2>&1");
    

The latter works with most command-line tools, btw.



来源:https://stackoverflow.com/questions/31221196/wkhtmltopdf-writes-in-apache-error-log-for-every-pdf-created

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!