SharePoint Designers

All about Branding & Customizations in SharePoint

Use case:
 
You are working on some task which requires logging to event viewer, file, console or combination of such mediums.
Why?
 
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.
Prerequisites:
Install nuget for visual studio.
How?
 
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
  • SQLite
  • Asp.Net Trace
  • Console
  • EventLog
  • File
  • SMTP
  • much more

Example:
See vss_br/bms/trunk/bms/bmsmigration project in vss for rerence implementation in console application for logging in console and file.
References:

  1. Code project tutorial
  2. Configuration Examples
  3. Log4net config example to Log into console and file both
  4. Official Home page

If You have any questions you can contact our sharepoint development team at binaryrepublik.com

Tags: log4net

Views: 46

Reply to This

Events

Birthdays

© 2013   Created by Christian Ståhl.

Badges  |  Report an Issue  |  Terms of Service