Our use of cookies

We use cookies to tailor your experience, gather analytics, and provide you with live assitance. By clicking "Accept" or continuing to browse our site you agree to the use of cookies. For more details please read our Cookie Policy.

Configure SQList to send email alerts when errors are logged

By default, SQList logs all messages to its internal table, which is automatically trimmed to keep the last 24 hours. This is the log that is visible in SQList Manager.

Additionally, all messages of severity Warn or higher are logged to the Windows Event Log. Using Windows Event Viewer these can be searched using various filters.

SQList does not have a built-in feature to send email alerts when errors are logged; however, SQList uses NLog as its log writer (a well established logging utility) which is configured by the  C:\Program Files\AxioWorks\SQList\NLog.config configuration file.

It is possible to modify this file to add an email alert for errors. See the step-by-step below on how to achieve that.

Configure NLog to send email alerts when errors are logged


Note: for this example we will use an SMTP server that uses secure basic authentication (or, in other words, username and password via SSL). If you plan to use a different type of connection, please refer to the NLog documentation that can be found here:


You will need a basic understanding of the XML syntax to apply these changes.

Step 1) Open SQList Manager and, if running, stop the SQList service.


Step 2) Open the file  C:\Program Files\AxioWorks\SQList\NLog.config with a plain text editor in Administrator mode and locate the closing tags </targets> and </rules>;



Step 3) Right above the </targets> tag described in step 2, insert the following code:


<target name="batchedEmaiAlert"
    xsi:type="BufferingWrapper"
   bufferSize="10"
   flushTimeout="10000">

   <target name="emaiAlert" xsi:type="Mail"
      useSystemNetMailSettings="false"
      smtpAuthentication="Basic"
      smtpServer="smtp.server.name"
      smtpUserName="alerts@your.domain"
      smtpPassword="password123"
      enableSsl="true"
      from="alerts@your.domain"
      to="service_team@your.domain"
      subject="AxioWorks SQList error alert (machine: ${machinename})"
      body="${level}: ${message}${newline}" />
</target>

The settings to configure are:

  • bufferSize: the number of error messages to batch together in a single email (to avoid flooding the inbox with individual emails);
  • smtpServer: enter here the name of IP address of the SMTP server;
  • smtpUsername, smtpPassword: the credentials to authenticate against the SMT server;
  • from, to: the From and To email addresses for the notification email.

Step 4) Right above the </rules> tag described in step 2, insert the following code:

<logger name="*" minlevel="Error"  writeTo="batchedEmaiAlert"/>

In this example we store all messages of severity Error or higher; the available levels are, in order of severity lower to higher:

  1. Trace
  2. Debug
  3. Info
  4. Warn
  5. Error
  6. Fatal

Step 5) Save the file. The final file should look like this:

Image Placeholder


Step 6) Open SQList Manager and start the SQList service.


Important:

  1. Depending in the level of logging you choose, the number of email could be substantial, ensure you keep it under control and always resolve SQList errors;
  2. SQList cannot check that emails are sent successfully, ensure that the SMTP server and credentials are correct and valid;
  3. When you upgrade SQList to newer versions, ensure that you take a copy of the NLog.config and re-apply these changes after the upgrade as been installed.

Final notes:

You can use this approach to configure different email alerts for different severity by creating multiple <target> and <logger> elements.

If you require any assistance with this configuration, please contact our Support Team at support@axioworks.com.