You are working on some task which requires logging to event viewer, file, console or combination of such mediums.
Most of the time you have to write same string to console and file with two different lines of code. That will cause the code look ugly and while changing messages, developer has to make sure to update both lines. Additional errors may occure due to the mistakes.
Install nuget for visual studio.
Right click on your project and click on library package manager. Search for log4net and choose appropriate version as per your visual studio application. Click on install.
What are different mediums where I can log?
- MS SQL Server
- MS Access
- Oracle 9i
- Oracle 8i
- IBM DB2
- Asp.Net Trace
- much more
See vss_br/bms/trunk/bms/bmsmigration project in vss for rerence implementation in console application for logging in console and file.
- Code project tutorial
- Configuration Examples
- Log4net config example to Log into console and file both
- Official Home page