title: nLog: Filter or remove message
body: <p>How do I filter or remove unwanted message from Info level log?
  Here is the my result of the logs.</p>
  
  <p><strong>Log Result</strong></p>
  
  <p><a href="https://i.stack.imgur.com/58QCp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/58QCp.png" alt="enter image description here"></a></p>
  
  <p>I only want to log the yellow color only. But whatever I try, I cannot remove the extra log before and after the yellow color above. Here is my code.</p>
  
  <pre><code>public IActionResult Index()
  {
      _logger.LogInformation("--- THIS IS MY MESSAGE ---");
      return View();
  }
  </code></pre>
  
  <p><strong>nlog.config</strong></p>
  
  <pre><code>  ...
  &lt;target xsi:type="File" name="activityLog" fileName="${gdc:item=appbasepath}\Logs\log-activity-${shortdate}.log"
          layout="${longdate}|${uppercase:${level}}|${message:raw=true}" /&gt;
    ...
  &lt;logger name="*" level="Info" writeTo="activityLog" /&gt;
    ...
  </code></pre>