Nlogs configuration is not being loaded after update

108 views
Skip to first unread message

qmc...@gmail.com

unread,
May 18, 2021, 10:30:14 AM5/18/21
to Excel-DNA
Hi,
I updated EXCEL DNA from 0.34.6 to 1.1.1. Nlogs configuration is not being loaded after the update. Below was my myaddin.xll.config.
in the properties, the build action is "None".
Also I tried to add Nlog.config, and Nlog.config was able to picked up. Not sure why <section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog" /> is not working anymore.


<?xml version="1.0" encoding="utf-8"?>

<configuration>
  <configSections>
    <section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog" />
  </configSections>
  <system.diagnostics>
    <sources>
      <source name="ExcelDna.Integration" switchValue="Verbose">
        <listeners>
          <remove name="Default" />
          <add name="LogDisplay" type="ExcelDna.Logging.LogDisplayTraceListener,ExcelDna.Integration">
            <filter type="System.Diagnostics.EventTypeFilter" initializeData="Off" />
          </add>
          <add name="NLogListener" type="NLog.NLogTraceListener,NLog">
            <filter type="System.Diagnostics.EventTypeFilter" initializeData="All" />
          </add>
        </listeners>
      </source>
    </sources>
  </system.diagnostics>
        xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
        autoReload="true"
        throwExceptions="false"
        internalLogLevel="Info" internalLogFile="c:\temp\nlog-internal.log">
    <targets>
      <target name="debugger" xsi:type="Debugger"
              layout="NLOG: ${longdate}|${level:uppercase=true}|${logger}[${event-properties:EventID}]|${message}" />
      <target xsi:type="File" name="logfile"
              layout="${longdate} ${uppercase:${level}} --- [${callsite:className=true:includeNamespace=false:fileName=false:includeSourcePath=false
          :methodName=true:cleanNamesOfAnonymousDelegates=false}] ${message}"
              fileName="${specialfolder:folder=ApplicationData}/myaddin/logs/current.log"
              archiveFileName="${specialfolder:folder=ApplicationData}/ myaddin/logs/logfile.{#}.log"
              maxArchiveFiles="7"
              archiveDateFormat="yyyyMMdd"
              archiveEvery="Monday" />
    </targets>
    <rules>
      <logger name="*" minlevel="Warn" writeTo="debugger" />
      <logger name="*" minlevel="Info" writeTo="logfile" />
    </rules>
  </nlog>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

qmc...@gmail.com

unread,
May 25, 2021, 9:21:51 AM5/25/21
to Excel-DNA
instead of putting in  myaddin.xll.config, I put it under app.config, then it can be picked up.
Reply all
Reply to author
Forward
0 new messages