1

I have several IIS Web Services using NLog for Common Logging.

I need to have only one configuration file for all the Web Services with this config values:

<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <targets>           
           <target name="sqlTarget" type="SqlDbTarget" />
           <target name="emailTarget" type="EmailTarget" layout="${plataforma-html-text-formatter:Titulo=Mail Title}" />
           <target name="snmpTarget" type="SNMPAuthenticatedTarget" />
        </targets>
        <rules>         
            <logger name="*" writeTo="sqlTarget" />
            <logger name="*" minlevel="Error" writeTo="emailTarget" />
            <logger name="*" minlevel="Error" writeTo="snmpTarget" />           
        </rules>
    </nlog>

Where I can leave this configuration values?

I have tested embed the NLog XML in machine.config and also applicationHost.config, but not luck. Also, I tested to leave NLog.config in C:\Windows\System32\inetsrv, but either.

felixmondelo
  • 1,324
  • 1
  • 10
  • 19
  • this? https://stackoverflow.com/questions/1838619/relocating-app-config-file-to-a-custom-path – Rand Random Aug 03 '22 at 14:22
  • @RandRandom My question is about NLog config file, seems that the link you share is for configuration files for usual applications. – felixmondelo Aug 03 '22 at 14:26
  • 1
    or this? https://stackoverflow.com/questions/15958271/make-nlog-config-file-load-the-file-from-d-dev-instead-of-bin-debug – Rand Random Aug 03 '22 at 14:26
  • Maybe that is the only option, change the code to use a single path ... I try to not modify the code, but maybe the only option is that you say – felixmondelo Aug 03 '22 at 14:29
  • 1
    disclaimer never used nlog, just google a bit and found this - the first URL was because I assumed that nlog is a section inside the app.config/web.config – Rand Random Aug 03 '22 at 14:33
  • Like this: https://stackoverflow.com/a/58904103/193178 ? – Rolf Kristensen Aug 03 '22 at 16:40

0 Answers0