There are 4 types of messages that we write to log file
error - for unrecoverable exceptions
warning - for recoverable/expected exceptions
debug - for debug information
trace - for maximum detailed messages
Logging to File
In this example, we’ll log into the file, so we need to use FileLogger class.
// Create logger and specify the output file
FileLoggerfileLogger=newFileLogger("output.log");// Create ViewerSettings and specify FileLogger
ViewerSettingsviewerSettings=newViewerSettings(fileLogger);try(Viewerviewer=newViewer("sample.docx",viewerSettings)){ViewOptionsviewOptions=HtmlViewOptions.forEmbeddedResources("result.html");viewer.view(viewOptions);}
After running code above output.log file will be created with the similar content:
[TRACE] Rendering into HTML with embedded resources.
[TRACE] Detecting file type by extension.
[TRACE] File type detected successfully: {}.
[TRACE] Opening document.
[TRACE] Applying options.
[TRACE] Converting page 1.
[TRACE] Page 1 conversion completed.
[TRACE] Converting page 2.
[TRACE] Page 2 conversion completed.
[TRACE] Releasing resources
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.