Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all

I need to customized log4net for two type of appender one is file and other is adoNet.We will log to file if we there is problem with connection with sql other wise it will log to database in the log table.

Please help me if somebody work in similar concept.

Thanks.
Posted

1 solution

What you are looking for doesn't currently exist in log4net, but it has been entered as a feature to be implemented. See here for more info.

Another way you could do this is by taking the source of the AdoNetAppender and FileAppender and merge them into a custom appender type.

Creating new appenders isn't difficult and the only new code required would be to check to see if the DB connection is available. If not, use the file appender.

For more info on creating appenders, see this article

Hope this helps
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900