O truque com NLog e LogEntries é certificar-se de colocar todos os seus dados de configuração de NLog em arquivos separados e, em seguida, usar as transformações web.config para determinar qual arquivo usar.
app.config
<configSections>
<section name="nlog"
type="NLog.Config.ConfigSectionHandler, NLog" />
....
</configSections>
<nlog configSource = “NLog.release.config” />
nlog.config
(Sem conteúdo, Copiar quando novo)
NOTA: Este é o uso do Sentinal para a IU
<?xml version="1.0" encoding="utf-8" ?>
<nlog >="http://www.nlog-project.org/schemas/NLog.xsd"
>="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true"
throwExceptions="true">
<extensions>
<add assembly="LogentriesNLog"/>
</extensions>
<!-- NLog example: https://github.com/nlog/nlog/wiki/Examples -->
<targets async="true">
<target xsi:type="NLogViewer"
name="sentinal"
address="udp://127.0.0.1:9999" />
</targets>
<rules>
<logger name="*" minlevel="Trace" writeTo="sentinal"/>
</rules>
</nlog>
nlog.release
(Sem conteúdo, Copiar quando novo)
NOTA: substitua as configurações de e-mail pelas suas
<?xml version="1.0" encoding="utf-8" ?>
<nlog >="http://www.nlog-project.org/schemas/NLog.xsd"
>="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true"
throwExceptions="true">
<extensions>
<add assembly="LogentriesNLog"/>
</extensions>
<!-- NLog example: https://github.com/nlog/nlog/wiki/Examples -->
<targets>
<target name="logentries" type="Logentries"
debug="false"
httpPut="false"
ssl="false"
layout="${logger} : ${LEVEL} : ${message}" />
<target name="email-Errors" xsi:type="Mail"
smtpServer="smtp.sendgrid.net"
smtpPort="587"
smtpUsername="XXXXXXXXXX"
smtpPassword="XXXXXXXXXXXXXXX"
smtpAuthentication="Basic"
from="XXXXXXXXX@YYYYYYYYYY.com"
to="XXXXXXXXX@YYYYYYYYYY.com"
subject="XXXXXXXXXXXXXX"
html="true" />
</targets>
<rules>
<logger name="*" minlevel="Debug" appendTo="logentries"/>
<logger name="*" minlevel="Warn" writeTo="email-Errors" />
</rules>
</nlog>