Using the APDFL LogParams Class for Logging (.NET and Java)
Estimated Reading Time: 1 MinutesFor added control over logging in APDFL's .NET and Java interfaces, users can take advantage of the LogParams class. This class has the properties:
- logOutputFlags: logging type. Available: "Console", "File", "Event Log" (Windows only), and "None" (silences logging)
- logFileName: path to output file (if using OutputFlag "File")
- logFormat: a string that allows customization of the log formatting. See the components below:
- "%d" - current date (mmddyyyy). Example: 07292013
- "%t" - current time (hhmmss). Example: 121311
- "%T" - full date. It contains current date, current time and the timezone (yyyy-mm-ddThh:mm:ss /-hh:mm). Example: 1969-07-20T:16:47-04:00
- "%s" - error source. Example: "DLFramework"
- "%e" - error type. It can be debug, info, warning, error, fatal. The value which will be output within this marker depends on severity value. It always outputs "error" string.
- "%m" - error message. Example: "Exception: thisPDF.pdf: This file cannot be found. Error number: 1074397201"
By default, the following string format is used: "%T | %s | %e | %m"
Here's an example C# code block that will write logs to a plain text file with default formatting:
LogParams lp = new LogParams(); lp.LogFileName = "log.txt"; lp.LogOutputFlags = LogOutputFlags.File; lib.LogParams = lp;
And here's an example of how the text in that file will look:
2026-02-27T12:42:24-06:00 | DLFramework | error | Exception: MergePDF-out.pdf: Object label badly formatted. Error number: 537001993
As always, feel free to reach out to Datalogics support with any questions or concerns on using LogParams!