Skip to content

Instantly share code, notes, and snippets.

@Itoktsnhc
Last active April 28, 2018 13:22
Show Gist options
  • Save Itoktsnhc/ee2a5ac1c43b84ed1d37689695383e25 to your computer and use it in GitHub Desktop.
Save Itoktsnhc/ee2a5ac1c43b84ed1d37689695383e25 to your computer and use it in GitHub Desktop.
sample nlog.config for NLog.Azure
<?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"
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
autoReload="true"
throwExceptions="false"
internalLogLevel="Off">
<extensions>
<add assembly="NLog.Azure" />
</extensions>
<targets>
<target type="Console" name="console" layout="${longdate} ${uppercase:${level}} ${message}" />
<target xsi:type="AsyncWrapper"
name="asyncAppendBlob"
queueLimit="1000"
timeToSleepBetweenBatches="50"
batchSize="200"
overflowAction="Grow">
<target type="AzureAppendBlob"
name="appendBlob"
layout="${longdate} ${logger}:${uppercase:${level}} ${message} ${exception:format=tostring}"
connectionString="FILLME"
subFolderPath="subFolder"
container="logtest"
blobName="${shortdate}.log" />
</target>
<target xsi:type="AsyncWrapper"
name="asyncStorageQueue"
queueLimit="1000"
timeToSleepBetweenBatches="50"
batchSize="200"
overflowAction="Grow">
<target type="AzureStorageQueue" name="azureStorageQueue"
layout="${longdate} ${logger}:${uppercase:${level}} ${message} ${exception:format=tostring}"
connectionString="FILLME"
queueName="logger" />
</target>
<target xsi:type="AsyncWrapper"
name="asyncStorageTable"
queueLimit="1000"
timeToSleepBetweenBatches="50"
batchSize="200"
overflowAction="Grow">
<target type="AzureTable" name="azureTable"
layout="${longdate} ${logger}:${uppercase:${level}} ${message} ${exception:format=tostring}"
connectionString="FILLME"
tableName="logger"
partitionKey="loggerTest" />
</target>
<target xsi:type="AsyncWrapper"
name="asyncEventHubWrapper"
queueLimit="1000"
timeToSleepBetweenBatches="50"
batchSize="30"
overflowAction="Grow">
<target type="AzureEventHub" name="azureEventHub"
layout="${longdate} ${logger}:${uppercase:${level}} ${message} ${exception:format=tostring}"
connectionString="FILLME" />
</target>
</targets>
<rules>
<!--<logger name="*" minlevel="Trace" writeTo="asyncWrapperSelf" />-->
<!--<logger name="*" minlevel="Trace" writeTo="appendBlob" />-->
<!--<logger name="*" minlevel="Trace" writeTo="azureStorageQueue" />-->
<!--<logger name="*" minlevel="Trace" writeTo="asyncStorageQueue" />-->
<!--<logger name="*" minlevel="Trace" writeTo="azureTable" />-->
<!--<logger name="*" minlevel="Trace" writeTo="asyncStorageTable" />-->
<logger name="*" minlevel="Trace" writeTo="azureEventHub" />
<!--<logger name="*" minlevel="Trace" writeTo="asyncEventHubWrapper" />-->
</rules>
</nlog>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment