I have an nlog config file set to file output and this code to set the output to RichTextBox
public void SetupFormLogger()
    {            
        NLog.Windows.Forms.RichTextBoxTarget target = new NLog.Windows.Forms.RichTextBoxTarget();
        target.Name = "control"; 
        target.Layout = "${longdate} ${level:uppercase=true} ${logger} ${message}";
        target.ControlName = richtextLog.Name;
        target.FormName = this.Name;
        target.TargetForm = this;
        target.AutoScroll = true;
        target.MaxLines = 10000;
        target.UseDefaultRowColoringRules = false;
        target.RowColoringRules.Add(
            new RichTextBoxRowColoringRule(
                "level == LogLevel.Trace", // condition
                "WhiteSmoke", // font color
                "Black", // background color
                FontStyle.Regular
            )
        );            
        target.RowColoringRules.Add(new RichTextBoxRowColoringRule("level == LogLevel.Debug", "Gray", "Black"));
        target.RowColoringRules.Add(new RichTextBoxRowColoringRule("level == LogLevel.Info", "WhiteSmoke", "Black"));
        target.RowColoringRules.Add(new RichTextBoxRowColoringRule("level == LogLevel.Warn", "Yellow", "Black"));
        target.RowColoringRules.Add(new RichTextBoxRowColoringRule("level == LogLevel.Error", "White", "DarkRed", FontStyle.Bold));
        target.RowColoringRules.Add(new RichTextBoxRowColoringRule("level == LogLevel.Fatal", "Yellow", "DarkRed", FontStyle.Bold));
        AsyncTargetWrapper asyncWrapper = new AsyncTargetWrapper();
        asyncWrapper.Name = "AsyncRichTextBox";
        asyncWrapper.WrappedTarget = target;
        SimpleConfigurator.ConfigureForTargetLogging(asyncWrapper, LogLevel.Debug);
    }
If I call this function it won't log anymore to file and if I don't call this function it logs to file. How can I make NLog to log both to file and RichTextBox at the same time?
And this is my nlog config file
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
      autoReload="true"
      throwExceptions="false"
      internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
  <variable name="myvar" value="myvalue"/>
  <targets>
      <target name="f" xsi:type="File" layout="${longdate} | ${module} | ${logger} | ${level} | ${message}" fileName="${basedir}/logs/${shortdate}.log" />      
   </targets>
  <rules>   
      <logger name="*" minlevel="Debug" writeTo="f" />      
  </rules>
</nlog>