Skip to end of metadata
Go to start of metadata

Enabling logging in your application using Crosslight Logging Framework is straightforward. This page provides step-by-step guidance to enable logging in your application.

To learn more about the Crosslight logging concept in general, see Implementing Application Logging.

On this page:

Configuring Crosslight Project

First of all, you will need to add reference Intersoft.Crosslight.Logging and Intersoft.Crosslight.Logging.{Platform} assemblies in your project as follows.

Notice that there are additional logging assemblies such as Intersoft.Crosslight.Logging.AzureInsights, Intersoft.Crosslight.Logging.AzureInsights.Server and Intersoft.Crosslight.Logging.EntityFramework.Server. These assemblies contains extensions module to write the LogEntry into Azure Application Insights Service and to a database through Entity Framework respectively.

To learn more how to enable Azure Application Insights logging and Entity Framework application logging see, Enabling Azure Insights Application Logging and Enabling Entity Framework Application Logging respectively.

Next, you need to ensure to preserve the assembly by adding the following code in each platform's AppInitializer.cs

Android AppInitializer.cs
iOS AppInitializer.cs

At server side (web project), you will need to manually call Intersoft.Crosslight.Logging.Server.LoggingService.Initialize(); at Global.asax.cs as follows.

Configuring the Log Writer

After your application is configured, you can then start configuring your LogWriter. The default LogWriter is an empty implementation, so you will need to specify the default trace listener that will actually write the log. As a starting point, you might want to have a diagnostic trace listener such as shown in the following code example.

Finally, you can register the trace listener to your LogWriter as follows.

Now you can start writing log in your application. This trace listener will write your log into the output window of the active development environment such as Visual Studio or Xamarin Studio.

To start writing log in your application, see Writing Log Entries.

To write your log into other media or repository, see Configuring Log Source and Trace Listeners.

To learn more about filter configuration in LogWriter, see Filtering Log Entries.


To learn more about application logging in Crosslight and see how it works, please checkout the following samples: