Reconfig existing logger

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Reconfig existing logger

KlaWill
Hello together

I have the following Problem

When i start my Programm i use the nlog.config for configuration of the logging.
This works well.
I write to multible targets beginning with the start of the programm.

Now i want to switch on / off a "Logtape" an therefore i want to use the
target "RichTextbox" in the configfile.

Target:
 <target xsi:type="RichTextBox"
              name="NlogRTB"
              formName="Logging"
              controlName="RTB"
              useDefaultRowColoringRules="true"
              />
rules:
<logger name="*" writeTo="NlogRTB"/>


In the programm i use
        Logg = LogManager.GetLogger("xyz")
        Logg.Factory.Configuration.RemoveTarget("nlogRTB")
        Logg.Factory.ReconfigExistingLoggers()

but the Window of the "RichTextBox" pop's up anyway.

Who can i switch off  (and switch on) the target in the programmcode whithout
reflecting the rest of the targets.

What do i wrong or have i missunderstood something?

Thanks a lot for every advice