Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop log4net from logging and release the last file

I'm using log4net in C# Win Form App and I have start/stop toggle button -

When I click "start" the log4net config are loaded and the log file is created - That is working.

But now I want to add the option to click "stop" button, for stopping the logger and of course release the file so I could open it with openFileDialog that I have in my app for reading the log file text with StreamReader to show the log file on a multiline textbox.

like image 605
Gal Barak Avatar asked Nov 07 '22 19:11

Gal Barak


1 Answers

You can modify the Threshold during runtime. To stop logging set it to Off. I have already shown how this works in this answer.

like image 96
Jürgen Müller Avatar answered Nov 14 '22 23:11

Jürgen Müller