I want to log my Exceptions from my .Net Application to the Airtable using the NLog
After configuring the nlog.config file. getting the following error in the Nlog internal logs:
Error WebServiceTarget(Name=ws): Error sending request Exception: System.Net.WebException: The remote server returned an error: (422) Unprocessable Entity.
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at NLog.Targets.WebServiceTarget.<>c__DisplayClass67_0.<CreateSendContinuation>b__1(IAsyncResult r)
Here is my nlog.config file
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true"
throwConfigExceptions="true"
internalLogLevel="info"
internalLogFile="c:\temp\internal-nlog-AspNetCore3.txt" >
<extensions>
<add assembly="NLog.Targets.Http" />
</extensions>
<targets>
<target type='WebService'
name='ws'
url='https://api.airtable.com/v0/BASE_ID/Log?api_key=API_KEY'
protocol="JsonPost"
encoding="UTF-8">
<parameter name="fields">
<layout xsi:type="JsonLayout" includeAllProperties="true">
<attribute name="Description" layout="teswt" />
</layout>
</parameter>
</target>
</targets>
<rules>
<logger name='*' writeTo='ws'></logger>
</rules>
</nlog>
Thanks In Advance