Reputation: 995
I am using elmah to handle exceptions. Now my needs have been increased and I want to log some warnings after few statements like NLog.
Here i want to add data in SQL database. I also want to add one column in elmh table, which tells me which row is belongs to error and which belongs to warning, because I need to render them separately. Eg. ElmahError.axd and ElmahWarn.axd.
I may need to override elmah class to achieve this, but is there any other library which gives both features, error handling and logging? What is the best way to get this done?
Upvotes: 2
Views: 981
Reputation: 5259
If you want to log warnings in ELMAH, you will need to log it as an exception. You can create a custom exception named WarningException
or something. With that said, ELMAH is created for errors and doesn't really fit well with other severities.
Adding custom data to ELMAH isn't possible either. Unless you fork the ELMAH source code and create a custom build of course. You will need to extend the Error
class among others.
I'm the founder of the cloud-based error management system elmah.io. We support all severities known from other logging frameworks. With my experiences developing elmah.io, I will recommend you to use ELMAH what it's good for (logging errors) and combining it with a logging framework of choice. We use Serilog to get structured logging in Elasticsearch, but NLog, log4net etc. should do the job as well.
Upvotes: 3