I am trying to learn using Log4Net to be able to improve my logging technique in my program. I have read the documents provided in the Log4Net website, however I have these questions in mind.
This is the most simple output shown in the example program on the Log4Net website produced by BasicConfigurator.Configure()
.
0 [main] INFO MyApp - Entering application.
36 [main] DEBUG Com.Foo.Bar - Did it again!
51 [main] INFO MyApp - Exiting application.
My program already has a pane (in debug mode) to show the flow of the program which cycles through numerous asynchronous attempts. So when I run it I can see the flow of the program (typical mass debugging method).
In this level, as far as I know by using Log4Net I can collect logs in those moments and these logs can be appended into so many different output methods such as console, external file, db and etc. This leads to double ups in the code. One line to output the logs to the UI and the other to log for Log4Net, in each test point.
Is there any method that I can output the contents of one of the appenders, such as the one shown above, to a variable of a type string or similar to be able to show it at runtime?
I am not sure how you can see the output of the console in the WPF application. And it seems quite funny to output the Log4Net into a file and then print the contests of it back to a string.
Update
The output of the Console Appender
can be seen in the Output window of Visual Studio when Show output from: drop-down is set to "Debug". Many thanks to @Aron for pointing it out.