This console application is written in C#, uses log4net, and targets .NET Core 2.
Create a .NET Core 2 console application and name it LoggingFun.
Right-click on the project and choose Manage NuGet Packages. Add "log4net".
Right-click and add a text file named "log4net.config" to the project.
Right-click on log4net.config and choose properties. Make sure you copy the file to the output directory.
Let's write "Hello World!" to the log.
Running this creates the "loggingfun.log" file.
The output in the file is simply "Hello World!". We can add formatting if we need the time and level of error displayed
in the log. We do this with log4net's
Now the program writes, "2017-09-12 21:05:06,868 ERROR - Hello World!".
I hope this little example of log4net helps you, and I welcome your feedback.
Here is a video of me performing this example.