I am trying to create 2 loggers (using NLog)
- First logger logs all the desired item to log in the solution
- The other one traces specific items (I do it to keep things clean and focused, and only run tracehere)
Below is the configuration
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
  <target name="logfile"
          xsi:type="File"
          layout="${longdate} ${level} ${threadid} ${callsite} ${message}"
          fileName="${basedir}\Logs\GatewayApplicationDebugAndErrorLog.txt"
          archiveNumbering="Rolling"
          maxArchiveFiles="10"
          archiveAboveSize="10000000"/>     
  <target name="J1939Trace"
          xsi:type="File"
          layout="${longdate} ${level} ${threadid} ${callsite} ${message}"
          fileName="${basedir}\Logs\J1939Trace.txt"
          archiveNumbering="Rolling"
          maxArchiveFiles="10"
          archiveAboveSize="10000000"/>
</targets>
<rules>
  <logger name="*" minlevel="Trace" writeTo="logfile" />
  <logger name="J1939Trace" maxlevel="Trace" writeTo="J1939Trace" final="true" />
</rules>
and usage is shown below
private readonly Logger logger = LogManager.GetCurrentClassLogger(); // Generic Logger
private readonly Logger j1939Logger = LogManager.GetLogger("J1939Trace"); // Specific Logger.
What I observe is that the specific logger item is also logged in generic log item and I don't want that duplication. Any ideas what am I doing wrong?
 
     
    