Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add target of NLog to a specific textbox control, so the log messages will be shown in that control

I have used following config of NLog to add the log text to control of specified Name on specified form.

<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
  <targets> 
    <target name="control" xsi:type="FormControl" append="true" 
            controlName="textBox1" formName="Form1"/> 
  </targets> 
  <rules> 
    <logger name="*" minlevel="Debug" writeTo="control"/> 
  </rules> 
</nlog> 

I have a form with name Form1 and control on it with the name textBox1. Still nLog cretes a new form in runtime and adds a docked textbox to it and shows the logs in it.

Now how to make nLogwrite the logs to MY form and MY Control

like image 963
Sachin Chavan Avatar asked May 17 '10 10:05

Sachin Chavan


1 Answers

Got the issue:

The names used in config are case sensitive.

textBox1 should have been TextBox1

like image 75
Sachin Chavan Avatar answered Sep 28 '22 05:09

Sachin Chavan