Reputation: 675
I am using Nlog for Error loggin. I have configured the Nlog using the following code in web.config but the programs throws error "Unable to find the requested .Net Framework Data Provider. It may not be installed."
<nlog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" throwExceptions="true" internalLogFile="c:\nlog.txt" internalLogLevel="Debug">
<extensions>
<add assembly="NLog.Extended" />
</extensions>
<targets>
<target name="Console" xsi:type="Console" layout="${level:uppercase=true} ${message}"/>
<target name="DelivrosLogFile" xsi:type="File" fileName="C:\DelivrosLogs\Delivros.log" layout="${longdate} |${message}| ${stacktrace}"/>
<target xsi:type="Database" name="DelivrosDatabaseLogging" connectionStringName="DelivrosEntities"
commandText="INSERT INTO tbl_ErrorLogIn( Event_ID,Priority,Severity,Title,Timestamp,MachineName,AppDomainName,PocessID,ProcessName,ThreadName,Win32ThreadId,Message,FormattedMessage) VALUES (@Event_ID,@Priority,@Severity,@Title,@Timestamp,@MachineName,@AppDomainName,@PocessID,@ProcessName,@ThreadName,@Win32ThreadId,@Message,@FormattedMessage)">
<parameter name="@Event_ID" layout="0"/>
<parameter name="@Priority" layout="3"/>
<parameter name="@Severity" layout="${level}"/>
<parameter name="@Title" layout="Journal API"/>
<parameter name="@Timestamp" layout="${date}"/>
<parameter name="@MachineName" layout="${machinename}"/>
<parameter name="@AppDomainName" layout="Journal API"/>
<parameter name="@PocessID" layout="${processid}"/>
<parameter name="@ProcessName" layout="${processname}"/>
<parameter name="@ThreadName" layout="${threadname}"/>
<parameter name="@Win32ThreadId" layout="${threadid}"/>
<parameter name="@Message" layout="${exception}"/>
<parameter name="@FormattedMessage" layout="${message} "/>
</target>
</targets>
<rules>
<logger name="*" levels="Info,Warn,Error,Fatal" writeTo="Console"/>
<logger name="*" levels="Info,Warn,Fatal" writeTo="DelivrosLogFile"/>
<logger name="*" levels="Error" writeTo="DelivrosDatabaseLogging"/>
</rules>
I stuck with this for Four days...is there any one out there who can help me....
Upvotes: 0
Views: 703
Reputation: 9
I can just add that if you already used EntityFramework you cannot simply change the provider in your connection string, as your Entity will not work. You can add another connection string for your error logging with providerName="System.Data.SqlClient".
Upvotes: 0
Reputation: 675
It was given providerName="System.Data.EntityClient" in connection string and i changed that to providerName="System.Data.SqlClient"
Upvotes: 1