In my I was showing how to teach to log events into a SQL Server database, today it is time to reveal the last part of this blog series.

Having everything in SQL is great, and it already enables you run queries, but wouldn’t it better to have some sort of a visual dashboard showing you all new events, highlighted by severity and type, and also let you filter those?

I liked that idea and decided to try out how component by FaktNet AS can accomplish this.

The is free for development workstations, which is awesome.
The installation was quite simple, it is just an ASP.NET application, really. I configured it as a separate site in IIS to simplify things.
The configuration was quite easy too:

  1. Configure the LocalSql datasource where you need to specify the connection string to your SQL Server database with the Log table:
<datasource name="LocalSql"

Description="Log4Net logging events stored in the SQL Server database on the local machine">
 <provider type="L4NDashSqlServerProvider.SqlServerProvider" 

assembly="L4NDashSqlServerProvider, Version=2.4, Culture=neutral"/>  
 <predefinedsearchfilter value="Filters\DefaultSearchFilters.xml"/>  
 <providersettings>  
 <connectionstring value="user id=sa;password=*;Data Source=(local);Database=db"/>  
 <TableName value="Log" />  
 <!--  
 Defines timeout (in seconds) for sql commands, if the log table is huge or the database server  
 is "jammed" you may need to increase this  
 -->  
 <SqlCommandTimeout value="60"/>  
  
 <!--Max number of rows to retrieve for the log rows panel-->  
 <MaxNoOfRowsToRetrieve value="1000"/>  
  
 </providersettings>  
 ...  


2. Verify that the “TableName” and column reference correspond to your table in SQL:

<NameMapping TableName="Log"
 IdColumn="Id"  
 DateColumn="Date"  
 LevelColumn="Level"  
 ThreadColumn="Thread"  
 LoggerColumn="Logger"  
 MessageColumn="Message"  
 ExceptionColumn="Exception" />  
  
  1. If you extended the ADONetAppender , define the following custom columns:
<customcolumn name="SCUser">
 <label value="User Name" />  
 <rowstabledisplay value= "yes" />  
 <rowsdetaildisplay value= "yes" />  
 <filter value="yes" />  
</customcolumn>  
  
<customcolumn name="SCItemId">  
 <label value="Item Id" />  
 <rowstabledisplay value= "yes" />  
 <rowsdetaildisplay value= "yes" />  
 <filter value="yes" />  
</customcolumn>  
  
<customcolumn name="RawUrl">  
 <label value="Raw Url" />  
 <rowstabledisplay value= "yes" />  
 <rowsdetaildisplay value= "yes" />  
 <filter value="yes" />  
</customcolumn>  
  

Now you can run the Log4Net Dashboard application, but before you can view any of the Sitecore logs from the database, you need to make sure to select “LocalSql” as your default datasource:

  That’s all – refresh the application and enjoy nice visualization of how your app is doing:

  

Now that we have everything running smoothly, let’s add another piece. Let’s bring this application to Sitecore desktop. The easiest way to do it is to change the configuration of the default Sitecore Logging application. Specifically:

  1. Login to Desktop –> core database.

  2. Navigate to /sitecore/content/Applications/Reports/LogViewer:

  3. Paste the URL of your Log4Net Dashboard application into the “Application” field:

Now refresh the browser and open Log Viewer application:

Here you go – refreshed Log Viewer available from Sitecore desktop interface:

In production, I’d disabled anonymous access to this application and probably added some IP restrictions too, so this app can safely be access from outside.

Of course for running in production, from the Log4Net Dashboard vendor.

I suggest you try it and check out this video to see more of the specific capabilities of this tool:

</a>

you will need to get the license