Logging routes can be configured to write logs to separate external .log files. These files can later be opened for viewing in the Diagnostics Console or in a text editor such as Notepad.
To configure Hyland.Logging to write log files:
- Open the .json file for the application that contains the Hyland.Logging element.
- Locate the Hyland.Logging element.
-
Add the following logging route to the element:
-
"File": {
"File": "FILEPATH",
"Maximum-Level": "Critical",
"Minimum-Level": "Information",
"write-to:File.rollingInterval": "Day",
"write-to:File.rollOnFileSizeLimit": true,
"write-to:File.retainedFileCountLimit": 30,
"write-to:File.fileSizeLimitBytes": 10485760
}
-
"File": {
- Replace "FILEPATH" with the file path for the log file, including the name of the file you want the log to be saved as. This file must be a .log file. For example, "./logs/ApiServer.log" would write the logs to a file called ApiServer.log in the /logs directory within the directory where the application is installed.
- Set the "Maximum-Level" attribute to the maximum level of severity you want to be reported in the log.
- Set the "Minimum-Level" attribute to the minimum level of severity you want to be reported in the log.
-
Set the " write-to:File.rollingInterval" attribute to the interval that you want a new log created. The following intervals are available for use:
Interval
Description
Minute
A new log file is created every minute.
Hour
A new log file is created every hour.
Day
A new log file is created every day.
Month
A new log file is created every month.
Year
A new log file is created every year.
Infinite
A new log is never created.
- Set the "write-to:File.rollOnFileSizeLimit" attribute to "true" or "false" to limit log files based on size. If set to "true", a new log file to be created when the current log file reaches the configured size limit.
- Set the "write-to:File.retainedFileCountLimit" attribute to the number of log files to be kept before older files are deleted. If you do not want to delete older files, you can set the value to "null".
- Set the "write-to:File.fileSizeLimitBytes" attribute to the maximum size in bytes a log file can be before creating a new file. This attribute is only active if "write-to:File.rollOnFileSizeLimit" is set to "true".
- Save the file and close the text editor.
- Reset the application.