export To File
Exports collected logs to a compressed and JSON-encoded file on the local file system.
This method is not visible to Java because the ULong return type is not supported.
DittoLogger locally collects a limited amount of logs at DittoLogLevel.DEBUG level and above, periodically discarding old logs. This internal logger is always enabled and works independently of the enabled setting and the configured minimumLogLevel. Its logs can be requested and downloaded from any peer that is active in a Ditto app using the portal's device dashboard. This method provides an alternative way of accessing those logs by exporting them to the local file system.
The logs will be written as a gzip compressed file at the path specified by the path parameter. When uncompressed, the file contains one JSON value per line with the oldest entry on the first line (JSON lines format).
Ditto limits the amount of logs it retains on disk to 15 MB and a maximum age of three days. Older logs are periodically discarded once one of these limits is reached.
This method currently only exports logs from the most recently created Ditto instance, even when multiple instances are running in the same process.
For more granular exception handling check the DittoError.IoErrorReason subtypes:
Return
The number of bytes written to disk.
Since
4.8.0
See also
Parameters
The path of the file to write the logs to. The file must not already exist, and the containing directory must exist. It is recommended for the path to have a .jsonl.gz
file extension but Ditto won't enforce it, nor correct it.
Throws
When the file cannot be written to disk. Prevent this by ensuring that no file exists at the provided path, all parent directories exists, sufficient permissions are granted, and that the disk is not full.