Logging in custom database in Microsoft Dynamics CRM

The tool is available for download at the codeplex site: https://enterpriselogger.codeplex.com/.

The entire documentation of the tool and how to use it can be found in the documentation tab in the codeplex site. In case you want to keep reading this blog, I suggest you go back to the link:  https://debajitcrm.wordpress.com/2014/06/26/enterprise-logger-for-microsoft-dynamics-crm/ and gather an idea about the tool and what it does.


Here we would see how we can log in custom database from CRM just by tweaking the configuration page without even changing a single line of code. Please note that for this to work, the users should have access to the custom database with write permissions to the table where logging would be done.

I come back to the configuration page of “Xrm Logger” solution and this time I select “Database” as the logging mechanism.


The following information needs to be entered

  • Connection String :  the connecting string to the custom database
  • Table name : the name of the table where logging would be done.
  • Message – The column name of the table where the Error Message/ Warning/ Message logged by the logger would be stored
  • Message Type – The column name in the custom database table that would store the value indicating where it is Error/ Warning/ Message
  • Stack Trace – The column to store the Stack Trace information in case of an error
  • Source Method – The column to store the name of the method from where the logger has been invoked. Basically whatever you pass in the parameter methodSource of the logging method, that value would be stored here
  • Log Time – The timestamp when the logging happened.


I have a custom database where the logging would be done. I enter all the fields and save the configuration. Please check for the screen shots below.

Screenshot for the database where logging would be done.



Values entered in the configuration entity


Please note that the connection string is stored in the CRM database Encoded and any user other than the system administrator would not be able to view the connecting string in plain text format.

Now I go again in CRM and create an account. And when I query the Log Table the following is the screenshot of what I get.


And you have logged in your custom database without changing a single line of code. Hope this would surely help.

In case this is not what you are looking for and you intend for and you want to keep the logging totally within the bounds of CRM, this tool won’t disappoint you. Please refer to the link – https://debajitcrm.wordpress.com/2014/06/26/logging-in-crm-entity-with-enterprise-logger-tool/

Author: Debajit

I am a Dynamics CRM Most Valuable Professional (MVP) with 12 years of experience in Microsoft .NET Technologies and 9 years of dedicated experience in Microsoft Dynamics CRM. I have worked with companies like Microsoft, SanDisk, PwC, TMF Group and have extensive experience of implementing complex CRM solutions from both offshore and client side. Currently the face of XrmForYou.com with significant experience in delivering corporate training on Dynamics CRM and have already delivered multiple projects to client through XrmForYou.com Author of multiple tools on codeplex including the 'Role Based Views' and 'CRM-Sharepoint Metadata manager & Attachment Extractor' which are available for commercial use under XrmForYou.com For consulting/ training, drop me a note at info@xrmforyou.com or visit our website www.xrmforyou.com

One thought on “Logging in custom database in Microsoft Dynamics CRM”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s