Forum How do I...?

Supress prince from filling up my error log

Cuberic
Using prince with php and my error log is filled with stuff like:

prince: http://192.168.50.4/siv-v3/filestore/generated_content/svgs/e6cb837c-ab19-4c21-a0eb-06321f700fb2.svg: warning: svg: image: @width with positive length value required.
prince: http://192.168.50.4/siv-v3/filestore/generated_content/svgs/e6cb837c-ab19-4c21-a0eb-06321f700fb2.svg: warning: svg: image: @height with positive length value required.
prince: http://192.168.50.4/siv-v3/filestore/generated_content/svgs/e6cb837c-ab19-4c21-a0eb-06321f700fb2.svg: warning: svg: image: @width with positive length value required.
prince: http://192.168.50.4/siv-v3/filestore/generated_content/svgs/e6cb837c-ab19-4c21-a0eb-06321f700fb2.svg: warning: svg: image: @height with positive length value required.
prince: http://192.168.50.4/siv-v3/filestore/generated_content/svgs/e6cb837c-ab19-4c21-a0eb-06321f700fb2.svg: warning: svg: image: @width with positive length value required.
prince: http://192.168.50.4/siv-v3/filestore/generated_content/svgs/e6cb837c-ab19-4c21-a0eb-06321f700fb2.svg: warning: svg: image: @height with positive length value required.
prince: http://192.168.50.4/siv-v3/filestore/generated_content/svgs/e6cb837c-ab19-4c21-a0eb-06321f700fb2.svg: warning: svg: image: @width with positive length value required.
prince: http://192.168.50.4/siv-v3/filestore/generated_content/svgs/e6cb837c-ab19-4c21-a0eb-06321f700fb2.svg: warning: svg: image: @height with positive length value required.
prince: http://192.168.50.4/siv-v3/filestore/generated_content/svgs/e6cb837c-ab19-4c21-a0eb-06321f700fb2.svg: warning: svg: image: @width with positive length value required.
prince: http://192.168.50.4/siv-v3/filestore/generated_content/svgs/e6cb837c-ab19-4c21-a0eb-06321f700fb2.svg: warning: svg: image: @height with positive length value required.
prince: http://192.168.50.4/siv-v3/filestore/generated_content/svgs/e6cb837c-ab19-4c21-a0eb-06321f700fb2.svg: warning: svg: image: @width with positive length value required.
prince: http://192.168.50.4/siv-v3/filestore/generated_content/svgs/e6cb837c-ab19-4c21-a0eb-06321f700fb2.svg: warning: svg: image: @height with positive length value required.
prince: http://192.168.50.4/siv-v3/filestore/generated_content/svgs/e6cb837c-ab19-4c21-a0eb-06321f700fb2.svg: warning: svg: image: @width with positive length value required.
prince: http://192.168.50.4/siv-v3/filestore/generated_content/svgs/e6cb837c-ab19-4c21-a0eb-06321f700fb2.svg: warning: svg: image: @height with positive length value required.
prince: http://192.168.50.4/siv-v3/filestore/generated_content/svgs/e6cb837c-ab19-4c21-a0eb-06321f700fb2.svg: warning: svg: image: @width with positive length value required.
prince: http://192.168.50.4/siv-v3/filestore/generated_content/svgs/e6cb837c-ab19-4c21-a0eb-06321f700fb2.svg: warning: svg: image: @height with positive length value required.
prince: http://192.168.50.4/siv-v3/filestore/generated_content/svgs/e6cb837c-ab19-4c21-a0eb-06321f700fb2.svg: warning: svg: image: @width with positive length value required.
prince: http://192.168.50.4/siv-v3/filestore/generated_content/svgs/e6cb837c-ab19-4c21-a0eb-06321f700fb2.svg: warning: svg: image: @height with positive length value required.
prince: http://192.168.50.4/siv-v3/filestore/generated_content/svgs/e6cb837c-ab19-4c21-a0eb-06321f700fb2.svg: warning: svg: image: @width with positive length value required.
prince: http://192.168.50.4/siv-v3/filestore/generated_content/svgs/e6cb837c-ab19-4c21-a0eb-06321f700fb2.svg: warning: svg: image: @height with positive length value required.

and would love to either supress all logs or anything less than an error.
mikeday
Are you calling Prince via the PHP wrapper, eg. prince.php?
Cuberic
This is how the pdf's are being generated

public function generate_pdf_prince_xml($file_name, $content)
{
// create temp file
file_put_contents(sys_get_temp_dir() . DS . $file_name . '-tmp.html', $content);

// create PDF
exec('prince --input=html --no-xinclude "' . sys_get_temp_dir() . DS . $file_name . '-tmp.html" -o "' . sys_get_temp_dir() . DS . $file_name . '-tmp.pdf"');

// get PDF content
$pdf_content = file_get_contents(sys_get_temp_dir() . DS . $file_name . '-tmp.pdf');

// delete temp files
unlink(sys_get_temp_dir() . DS . $file_name . '-tmp.html');
unlink(sys_get_temp_dir() . DS . $file_name . '-tmp.pdf');

return $pdf_content;
}
mikeday
You can specify a log file, or disable logging entirely. Which version of Prince are you using? Any reason why you cannot use the Prince PHP wrapper? :)
Cuberic
We're using the latest version.

No idea, I never set it up, and wouldn't know where to begin to adjust the code.
mikeday
You can pass "--silent --server" on the command-line, that will inhibit most warnings. Or you can specify "--log=PATH" where PATH is a path to a writable log file. But the log file will grow, so you may need to delete it from time to time.