Logging

Start page  Previous page  Next page

 

n2pdf offers the function of data logging for use in the context of the evaluation of conversions. The data supplied can only be used exclusively by administrators or developers as an aid in the elimination of problems.

 

Activation can be done using the function N2PDFSetGlobalOption with the global option N2PDFGLOBALOPTION_LOG_ENABLED. All errors which occur or information obtained is divided into different categories based on importance. This gives you control of the level at which messages are to be logged. Control of this level is provided via the option N2PDFGLOBALOPTION_LOG_LEVEL by specifying the desired level limit.

 

The setting for the activation of the logging and the log level is made via the function N2PDFSetGlobalOption. The following shows the individual options for data logging. The individual values are set via <OptionID> and <OptionStr> of the N2PDFSetGlobalOption function.

 

 

N2PDFGLOBALOPTION_LOG_ENABLED

This option enables the creation of the data log.

 

N2PDFVALUE_TRUE

Enable data logging

N2PDFVALUE_FALSE

Disable data logging

 

Example: Enable data logging

Call N2PDFSetGlobalOption ( N2PDFGLOBALOPTION_LOG_ENABLED, N2PDFVALUE_TRUE, "" )

 

 

114

If you wish to start the logging of the conversion as of a certain section, you can do so as an alternative to the global option by starting it only when N2PDFInit is called.

 

JobID = N2PDFInit ( N2PDFVALUE_INIT_USE_LOG )

 

 

Save the log file

You must enable this process in the N2PDFProcess call in order to save all of the information which has been gathered. This is done through the N2PDFVALUE_PROCESS_SAVE_LOG parameter. When this value is set, n2pdf also creates an XML file of the same name as the PDF file to be created and saves it to the same directory.

 

Example: Activation of the saving of all data gathered

Call N2PDFProcess ( JobID, PDFFileName, N2PDFVALUE_PROCESS_SAVE_LOG )

 

 

N2PDFGLOBALOPTION_LOG_LEVEL

The extent to which data is saved in the log file is dependent on the log level set. When you set a log level, all of the messages which equal or exceed this level are recorded in the log.

 

The order (from lowest to highest) of the log levels is:

 

ALL > TRACE > DEBUG > INFO > WARNING > ERROR > FATAL > OFF

 

Name

Level

Content

ALL

0

Unfiltered output of all messages

TRACE

1

Output of detailed debugging information

DEBUG

2

General debugging information (for troubleshooting)

INFO

3

General information (e.g. program start / end, processing time)

WARNING

4

Unexpected problems which have occurred but are not critical (e.g. missing CD records)

ERROR

5

Errors which were caught; continuation might be possible

FATAL

6

Critical errors causing the application to abort

OFF

7

No output of logging information; deactivation

 

Example: Setting the log level “ALL” (0) for unfiltered output of all messages

Call N2PDFSetGlobalOption ( N2PDFGLOBALOPTION_LOG_LEVEL, "0", "" )

 

Example: Setting the log level “WARNING” (4) for the output of messages of the levels “Warning", "Error" or "Fatal"

Call N2PDFSetGlobalOption ( N2PDFGLOBALOPTION_LOG_LEVEL, "4", "" )

 

 

Data logging via n2pdf.ini

In addition to script controlled activation of data logging, you can also enable logging via an entry in the n2pdf.ini file.

 

[Setup]

LogEnabled=1

LogLevel=5

 

The options LogEnabled and LogLevel allow you to enable logging and to set a certain level for global data logging. It is still necessary to use N2PDFProcess to save the log.