Layer2 Cloud Connector Logging and Alerting

 

The Layer2 Cloud Connector creates a variety of messages about its activities during synchronization. These messages will at first be filtered by the current global log level. Any message that gets through to this filter will be handed to the logging subsystem NLog. NLog is a free logging framework used by the Layer2 Cloud Connector system to manage its logging activities.

 

 

​By default, there will be one log file created for each connection. These files will be saved in the Logs subdirectory under the Layer2 Cloud Connecter data directory (usually here: C:\ProgramData\Layer2 Cloud Connector\Logs\) and they are named after the connection they belong to plus the .log extension. Also located in the Logs folder is the logging configuration file (Nlog.config). This file contains all logging-specific configuration settings and defines different log formats for the Connection Manager and the background Windows Service log files.

 

In the log configuration, file target is enabled by default. There are also example configurations for using the Windows Event Log, Email, or SQL databases.

 

More detailed information about how to configure NLog can be found in the NLog documentation at https://github.com/nlog/nlog/wiki.

Layer2 Cloud Connector Log to Windows Event Log

 

To configure the Layer2 Cloud Connector for logging into the Windows Event Log, a target section in the log configuration file needs to be created, similar to the following.

 

<target xsi:type="EventLog"
 name="EventLogTarget"
 layout="${message}"
 source="Layer2 Cloud Connector"
 log="Application" />

 

xsi:type

 

Defines the type of target to log to. For the Windows Event Log this needs to be “EventLog”, but there is a variety of different target types to use. The NLog documentation can be referred for a complete reference.

 

 

name

 

This attribute contains the name of the target to reference it in the rules configuration.

 

 

layout

 

This defines the layout of the log message to be written to the event log. It can contain several placeholders of the format ${placeholderName}. The NLog documentation can be referred for a complete reference.

 

 

source

 

The name of the source to appear in the Windows Event Log.

 

 

log

 

The name of the event log to write to.

 

 

IMPORTANT: To make the new target work, it is necessary to define a logging rule in the configuration similar to the following. This is placed in the bottom section for <rules>.

 

 

<rule minlevel="Warn"
name="*"
writeTo="EventLogTarget" />

Layer2 Cloud Connector Email Alert Configuration

 

​To configure the Layer2 Cloud Connector for sending e-mails for specific log-messages, a target section in the log-configuration file needs to be created, similar to the following.


<target xsi:type="Mail" 
 name="MailTarget"
 subject="Synchronization Error"
 body="${message}"
 from="[email protected]"
 to="[email protected]"
 smtpUserName="[email protected]"
 smtpPassword="myPassword"
 smtpAuthentication="Basic"
 smtpServer="mail.myCompany.com" />

 

xsi:type


Defines the type of target to log to. For mail alerts this needs to be “Mail”, but there is a variety of different target-types to use. The NLog documentation can be referred for a complete reference.

 

 

name

 

This attribute contains the name of the target to reference it in the rules configuration.

 

 

subject

 

This defines the subject of the mail alert. It can contain several placeholders of the format ${placeholderName}. The NLog documentation can be referred for a complete reference.

 

 

body

 

This defines the body-text of the mail alert. It can contain several placeholders of the format ${placeholderName}. The NLog documentation can be referred for a complete reference.

 

from

 

This attribute contains the email address of the sender.

 

 

to

 

This attribute contains the email addresses of the receipients, separated by semicolons.

 

 

smtpUserName and smtpPassword

 

These settings specify the account on the mail-server to be used to send the email alert.

 

 

smtpAuthentication

 

Defines the authentication mode to use when authenticating against the SMTP-mailserver. It can be one of the following:

 

     None

     Anonymous access to the mailserver. Username and password is not necessary with this setting.

 

 

     Basic

 

     Basic username and password authentication.

 

 

     Ntlm

 

     NTLM-Authentication. Username and password is not necessary with this setting.

 

 

If your email client also requires SSL connection to allow you to send mail, you may also need to include the parameter:

enableSsl="true"

 

 

IMPORTANT: To make the new target work, it is necessary to define a logging rule in the configuration similar to the following. This is placed in the bottom section for <rules>.


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

Layer2 Cloud Connector Log to SQL Databases

 

Please use the example Database target that is given in the Nlog.config file (usually located here: C:\ProgramData\Layer2 Cloud Connector\Logs\Nlog.config). This has the correct formatting to ensure all logs are passed to SQL without syntax errors.

 

To use a database target, a connection string must be edited and a target table must be created.The required SQL script to create an appropriate table called "CloudConnectorLogs" is also placed in the configuration file as a comment. The NLog documentation can be used for a complete reference.

 

 

IMPORTANT: To make the new target work, it is necessary to define a logging rule in the configuration similar to the following. This is placed in the bottom section for <rules>.


<logger minlevel="Warn"
name="*"
writeTo="SqlTarget" />

Known Issues and Troubleshooting Information

 

​Cloud Connector versions prior to 6.3.7.0 had the following two known issues with logging. To address these, please update your installation to 6.3.7.0 or higher:

  • Users with mail clients that required SSL connection could not user Nlog to forward email alerts as the enableSsl parameter was not yet available.
  • Users forwarding alerts to SQL may not get all alerts into the database due to a syntax issue.

 

The Layer2 Cloud Connector service does not pick up on logging changes (either Global Logging Level or customizations to the Nlog.config file) until the service is restarted.

 

NLog has its own internal logging that can be used to troubleshoot (more information regarding this feature, see the NLog Documentation). You need to add the following to the <nlog> node to enable it, where <path> equals a location on the host machine that the log file will be written to:

 

<xml version="1.0" encoding="utf-8"?>
<configuration>
<nlog internalLogFile="<path>" internalLogLevel="Trace">​

Ready to go next steps?

Register for free download.

Keep your Sharepoint in sync. Download and try today.

Questions? Contact us.

We are here to help. Contact us and our consulting will be happy to answer your questions.