Logging to Access Database

2 messages Options
Embed this post
Permalink
Blake

Logging to Access Database

Reply Threaded More More options
Print post
Permalink
Hi!  I'm new to NLog and have worked through some code samples, but I haven't found any examples on how to log to an Access Database.  Due to my design constraints I need to log to an Access database.  Does anyone have an example?  Thanks!
Blake

Re: Logging to Access Database

Reply Threaded More More options
Print post
Permalink
Never mind, I figured it out.  Here is an example for those who are interested:

 <target xsi:type="Database" name="accessDb" dbProvider="oledb">
      <commandText>insert into LogTable(message,time_stamp) values(@message,@time_stamp);</commandText>
      <connectionString>Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\temp\access.mdb;User Id=admin;Password=;</connectionString>
      <parameter name="@message" layout="${message}" />
      <parameter name="@time_stamp" layout="${date}" />
    </target>

    <logger name="*" minlevel="Debug" writeTo="accessDb" />