Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I want to create a own logging configuration without using enterprise library. I would like to create the logging configuration of throwing error in the catch block of c# asp.net web project.

What I have tried:

I already created error log file by own likewise can we do it or not i am just asking
Posted
Updated 30-Aug-18 5:06am

Yes it is possible to do such a thing.

But before you start I would look at the many other products available such as

1. NLog
2. Log4Net
3. ELMAH

to see if they meet your needs before you start to create your own.
 
Share this answer
 
Comments
Member 8583441 31-Aug-18 3:04am    
Using this methods is fine... thanks alot
Quote:
I want to create a own logging configuration without using enterprise library. I would like to create the logging configuration of throwing error in the catch block of c# asp.net web project.


You sure can create your own custom logging. However I recommend you to catch specific type of exceptions and only do a catch when it makes sense. A good rule of thumb is that you should only catch exceptions that you can properly deal with yourself. If you cannot handle the exception completely then you should let it bubble up to someone who can.

I would suggest you to give this article a read: C# Exception Handling Best Practices: Find & Create Custom Exceptions[^]
 
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