I've been meaning to create a landing page for all the log4net traffic on my blog. A friend of mine recently told me how difficult it is to drill through all the tutorials, so I decided to organize access to all the log4net stuff in one place. I'll keep this page updated as the blog grows.
If there are any log4net resources you think I should add to this list or blog about, please add them in the comments or send them to me via the contact link.
Log4Net Tutorials
If you've never used log4net before, you should begin with the getting started and configuration topics. You'll want to review the appender, layout, and patterns tutorials next, and use the others as you see fit.
- Getting Started with Log4Net - never used log4net before, but need to get running quickly?
- Basic XML Configuration - describes how to isolate log4net configuration to an XML file for easier modification.
- Appenders - a discussion of the catalog of appenders available in the log4net distribution. Need to figure out how to log to the console? Or a text file? Or a database? This tutorial is for you.
- Layouts and Patterns - want more control over the way your log looks?
- Using Logger Objects - learn to use logger objects to organize your logging code into independently configurable parts.
- Log Event Context - need some extra data in that log message? Maybe a call stack label, user identifier, or session moniker?
- Filters - learn how to tame that log output and filter out the stuff you don't want or need.
- Lossy Logging - learn about an advanced technique of optimizing your logging activity. Lossy logging gives you the benefit of a verbose log with the performance of a minimal logging scenario.
Recomended Practices
- Your Code - learn what you should do in your code to make the most of logging.
- Isolating Bugs - see how logging can be used to isolate production bugs.
Death by Logging Mantras
These mantras discuss specific scenarios where logging can cripple your application or its performance. These are in-process and links will become available as I write the posts.
- Mantra #1: Logs Consume Space
- Mantra #2: Logging Code is Still Code
- Mantra #3: Logging Consumes Resources
- Mantra #4: Noise is not a Log
Resources
- Extension Methods for Deferred Log4Net Message Formatting - a set of extensions methods that make deferring log message formatting easier.
- A Look at the Live Labs Simple Logging Framework - a quick overview of the Live Labs SLF, and some pros and cons it has with regard to log4net.
- Correlating and Grepping Logs with PowerShell - an example of how to leverage the log4net XML log output to slurp and correlate a log against the system event log.
- Log4Net Hack: Customizing Log File Paths After Configuration - demonstrates how to modify log4net configuration programatically.