Forum Feature requests

Log ONLY errors

mauritzhansen
Hi PrinceXML team,

Currently the log functionality writes an open and close line to the log file for every PDF generated, like so:

Thu Feb 21 00:02:58 2013: ---- begin
Thu Feb 21 00:02:59 2013: ---- end

Our system creates around 30_000 pdfs per week, and it would help to only write to the log file when there is an error or a warning. Am I missing something, and is it possible to configure the logging like this?

Thank you in advance,

Mauritz
mikeday
At the moment we don't have an option for this. Sometimes the begin/end timestamps can be useful for debugging unexpected delays in document generation. Would it be possible for you to delete the log file periodically?
mauritzhansen
Sure, there may be some reason to log every PDF creation in this way. However, I would then image the ability to add some optional fields such as input and output file names.

I am rotating this log and mailing it to myself on a daily basis.
mikeday
Perhaps the best option is to capture the log output from Prince so that it can be saved to your preferred logging mechanism, with additional information added where necessary.

The --server command-line argument formats Prince log output in a way that is easier to parse. The PHP and Java wrappers have support for capturing log messages in some situations, but not all, eg. not when calling convert_to_passthru in PHP. We hope to extend this in the future.
snapplez
+1 on this issue - it's 2016 now (three years later) - and PrinceXML still writes non-error messages into the error log.
mikeday
The recommended solution is to capture the log output using the interface provided by the PHP/Java/C# wrappers, that way it can be saved in whatever manner you prefer.
jagadeesh
Hi PrinceXML team,

"Perhaps the best option is to capture the log output from Prince so that it can be saved to your preferred logging mechanism, with additional information added where necessary."

Can you please advice how to extend prince logging when using java in a server application and add into the logs say "remoteIP address" information?
mikeday
The Java wrapper has a PrinceEvents interface you can implement to capture error and warning messages from Prince, once you have the messages that can be processed or logged in whatever way you prefer.