Im looking for an example log4net/log4j config which allows logging different types of errors to different destinations.
For example:
if service error happens (due to unavailability of some external service), I need the administrator of that service to be notified and possibly our developers or managers as well.
if internal error happens (due to malfunctioning of our app), I want the app developers to be notified (but not admins or managers), and provided enough info to solve that problem.
Please share your experience.
There is an example extension in the log4net download that shows how to add a custom trace level to log4net.
Have a look in extensions\net\1.0\log4net.Ext.Trace
You could create a custom level for SERVICE and a custom level for INTERNAL.
In you code you would use Log.SERVICE() and Log.INTERNAL()
Your configuration would be something like this: