Logging

Logging is controlled by the LOG_LEVEL parameter in the .env. There are 5 levels of logging available. Setting a log level will include all message in a level above (so setting LOG_LEVEL=WARN will also log ERROR and FATAL messages.

  1. FATAL: This is an issue that cannot be recovered from. Examples would include trying to start the service on a port that is already taken.

  2. ERROR: This is an issue that does not cause the entire system to fail (but will often cause a particular request to fail). Examples would include a failure to reach Rx-Universe on a particular request.

  3. WARN: This is an issue that does not cause a failure, but should be noted anyways. We do not currently produce WARN-level statements but in the future we might generate a warning if, for example, a request asks for a very large range of data.

  4. INFO: This is any non-issue that might be of interest. An example is logging the time, url, and IP address for each request made to the API.

  5. DEBUG: This is verbose information that would typically be used for in-depth tracing. If this is turned on log files will tend to grow very large very quickly.

If no LOG_LEVEL is set in the .envthen WARN will be used. If the .env is changed then the windows service must be restarted before the change takes effect.

Logs are written to \logs\production.log (so if the API is installed in c:\sites\api then the file will be c:\sites\api\logs\production.log The log is rotated daily, meaning the current file will be named production.log.yyyymmdd (e.g. production.log.20211216 if the day is December 16, 2021) and a new production.log will be created.