Skip to content

# Server log

The AyaNova server logs important events to the file log-ayanova.txt for troubleshooting purposes.

The server log is different and separate from the web app diagnostic log which shows errors and events that occur in the User's browser when using the AyaNova web app.

The server log file is archived when it reaches 1mb in size to a rotating set of 9 numbered archive log files, for example log-ayanova-1.txt, log-ayanova-2.txt etc.

This means there are a total of 10mb of server logs kept at any given time.

## Authorization Roles required

Editing or viewing this object from within the web app is only available to Users with the following roles:

- System operations
- System operations - restricted

## How to access the server error log

You can view the log file directly by opening the log file in an editor from the log path location or from within the AyaNova web app where you can view and / or download the log files from any remote location:

The server log form is accessed in the following ways:

- From the `Server operations` navigation drawer `Server log` item to open this form

## Log path

By default AyaNova logs to a `logs` folder in the location specified by AYANOVA_DATA_PATH setting. You can override this and set a custom log location by command line argument or by setting the "AYANOVA_LOG_PATH" environment variable.

Example command line log path parameter

`"dotnet run --AYANOVA_LOG_PATH=/home/gztw/Documents/temp/cmdlinelogs"`

## Log level

AyaNova supports 6 levels of logging, the default level is "Info" which is a medium level and will log general operations and any errors or warnings that may arise.

WARNING AyaNova server performance will be impacted negatively when setting a log level lower than Info. A very large amount of information is logged at Debug or lower levels and each item logged takes time away from the normal server operations. Unless directed to by technical support or attempting to diagnose a specific problem, you should avoid setting a log level lower than "Info" and if you do be sure to set it back the moment you don't need that detail anymore.

You can set the log level via environment variable or command line parameter "AYANOVA_LOG_LEVEL".

For example from the command line

`"dotnet run --AYANOVA_LOG_LEVEL=Info"`

Below are listed the accepted values for log level from highest to lowest. A level logs everything at that level and above. So, for example, "Trace" level will log the most and "Fatal" will log the least.

- `Fatal` - Critical errors that prevent AyaNova from running or force it to shut down. This setting results in the least amount of logging.
- `Error` - Logs all of the above plus errors that AyaNova can recover from and continue to operate.
- `Warn` - Logs all of the above plus issues that AyaNova can work around but should be looked into and are warnings to system operators.
- `Info` - Default level. Logs all the above levels plus normal behavior in low level of detail. Basic general operations are logged like startup and shutdown, configuration changes etc.
- `Debug` - Logs all the above plus every request to the server in detail and information about internal operations.
- `Trace` - Logs all the above plus highest level detail of internal program code operations. Useful primarily to AyaNova technical support to troubleshoot a specific issue, but too detailed for normal purposes.

## Troubleshooting logging

If you are having issues with logging you can enable a logger diagnostic log with a command line parameter or environment variable. Enabling this setting will cause a log file named "log-ayanova-logger.txt" to be written to the folder AyaNova is started in.

Command line parameter

`-- AYANOVA_LOG_ENABLE_LOGGER_DIAGNOSTIC_LOG=true`

or set the environment variable

`AYANOVA_LOG_ENABLE_LOGGER_DIAGNOSTIC_LOG = true`

Warning: this diagnostic log should be disabled as soon as it's not required. Unlike the normal log, this log file is not automatically trimmed so it will grow in size forever and will slow down the server.

## Errors that might appear in the log

### "Thread pool starvation"

e.g.

    2021-12-28 15:07:31.1867|WARN|Microsoft.AspNetCore.Server.Kestrel|As of "12/28/2021 23:07:20 +00:00", the heartbeat has been running for "00:00:01.3469381" which is longer than "00:00:01". This could be caused by thread pool starvation.

Typically under heavy reporting load but could occur in other circumstances, this error means the CPU on the server is overworked. Intermittenly this is ok but regularly it is not and indicates a need to increase CPU resources.