Logging Exceptions ... Where ?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
Can anybody guide which approach is the best for logging exceptions ?
The solution should consider performance, concurrency issues, production
scenarious, easy of data analysis & purging operations.

Logging Exceptions to,
1. Text Files
2. SQL Server
3. MSMQ
or, suggest any other ...

Regds
Gurminder
 
Hi Gurminder,

I would suggest you to log errors in the System EventLog.
Logging errors to event log is faster than logging errors to a text file.
But if you application is yet to be deployed to production server.
I would suggest you to go for logging errors to text file and once you are
done with fixing
regularly occuring errors you will be limiting the errors that will be
logged to the text file.
then you can move the error logging to the System Event log.

Final conclusion: System Event logging is the best recommended if you
consider Performance, concurrency issues, production
scenarious, easy of data analysis & purging operations.

and also you have various 3rd party , some free tools for analysing the
system Event logs.

[For you knowledge: you can read the Microsoft - Improving .NET Application
Performance and Scalability.pdf ebook published by microsoft which
is available for free download . This book clearly mentions how to log
errors and where and which is the best one to go for.]

you can download the book from here.
http://www.microsoft.com/downloads/...4D-F30E-4E72-B531-75384A0F1C47&displaylang=en

Thanks
Raghavendra
 
Thanks Raghavendra.

But, I would like to add that we are not considering event log because, in
production sceanrios, event logs can often go full and also in mulitple
application scenario, mangaing those become a headache.


Raghavendra T V said:
Hi Gurminder,

I would suggest you to log errors in the System EventLog.
Logging errors to event log is faster than logging errors to a text file.
But if you application is yet to be deployed to production server.
I would suggest you to go for logging errors to text file and once you are
done with fixing
regularly occuring errors you will be limiting the errors that will be
logged to the text file.
then you can move the error logging to the System Event log.

Final conclusion: System Event logging is the best recommended if you
consider Performance, concurrency issues, production
scenarious, easy of data analysis & purging operations.

and also you have various 3rd party , some free tools for analysing the
system Event logs.

[For you knowledge: you can read the Microsoft - Improving .NET Application
Performance and Scalability.pdf ebook published by microsoft which
is available for free download . This book clearly mentions how to log
errors and where and which is the best one to go for.]

you can download the book from here.
http://www.microsoft.com/downloads/...4D-F30E-4E72-B531-75384A0F1C47&displaylang=en

Thanks
Raghavendra


Gurminder said:
Hi,
Can anybody guide which approach is the best for logging exceptions ?
The solution should consider performance, concurrency issues, production
scenarious, easy of data analysis & purging operations.

Logging Exceptions to,
1. Text Files
2. SQL Server
3. MSMQ
or, suggest any other ...

Regds
Gurminder
 
You can define your own backing store for the event log to reduce the
possibility of filling it up. Any logging you do has the potential of
overruning the store.

Gurminder said:
Thanks Raghavendra.

But, I would like to add that we are not considering event log because, in
production sceanrios, event logs can often go full and also in mulitple
application scenario, mangaing those become a headache.


Raghavendra T V said:
Hi Gurminder,

I would suggest you to log errors in the System EventLog.
Logging errors to event log is faster than logging errors to a text file.
But if you application is yet to be deployed to production server.
I would suggest you to go for logging errors to text file and once you are
done with fixing
regularly occuring errors you will be limiting the errors that will be
logged to the text file.
then you can move the error logging to the System Event log.

Final conclusion: System Event logging is the best recommended if you
consider Performance, concurrency issues, production
scenarious, easy of data analysis & purging operations.

and also you have various 3rd party , some free tools for analysing the
system Event logs.

[For you knowledge: you can read the Microsoft - Improving .NET Application
Performance and Scalability.pdf ebook published by microsoft which
is available for free download . This book clearly mentions how to log
errors and where and which is the best one to go for.]

you can download the book from here.
http://www.microsoft.com/downloads/...4D-F30E-4E72-B531-75384A0F1C47&displaylang=en

Thanks
Raghavendra


Gurminder said:
Hi,
Can anybody guide which approach is the best for logging exceptions ?
The solution should consider performance, concurrency issues, production
scenarious, easy of data analysis & purging operations.

Logging Exceptions to,
1. Text Files
2. SQL Server
3. MSMQ
or, suggest any other ...

Regds
Gurminder
 
Hi Gurminder,


Since you are saying that the log might get filledup you can also move the
contents of it to a backup file once it is full and notify the developer
through some mechanism.

Also have a look at the Microsoft Exception Management Block.
You can download it from the following link
http://www.microsoft.com/downloads/...FamilyID=8CA8EB6E-6F4A-43DF-ADEB-8F22CA173E02

Its a 600 Kb file

This gives you the option of logging errors into
-> System eventlog
-> Email notification ( error through email )
-> Database ( logging into database )

may be you can use a mixture of this depending on the scenario.

Also have a look at this
http://www.c-sharpcorner.com/ExceptionHandling.asp

interesting article to read on logging errors.
http://www.c-sharpcorner.com/Code/2003/Sept/CustomExceptionsUsingMSExpBlock.asp

Hope all this helps you in designing a better error logging mechanism.

Thanks
Raghavendra

David Levine said:
You can define your own backing store for the event log to reduce the
possibility of filling it up. Any logging you do has the potential of
overruning the store.

Gurminder said:
Thanks Raghavendra.

But, I would like to add that we are not considering event log because, in
production sceanrios, event logs can often go full and also in mulitple
application scenario, mangaing those become a headache.


Raghavendra T V said:
Hi Gurminder,

I would suggest you to log errors in the System EventLog.
Logging errors to event log is faster than logging errors to a text file.
But if you application is yet to be deployed to production server.
I would suggest you to go for logging errors to text file and once you are
done with fixing
regularly occuring errors you will be limiting the errors that will be
logged to the text file.
then you can move the error logging to the System Event log.

Final conclusion: System Event logging is the best recommended if you
consider Performance, concurrency issues, production
scenarious, easy of data analysis & purging operations.

and also you have various 3rd party , some free tools for analysing the
system Event logs.

[For you knowledge: you can read the Microsoft - Improving .NET Application
Performance and Scalability.pdf ebook published by microsoft which
is available for free download . This book clearly mentions how to log
errors and where and which is the best one to go for.]

you can download the book from here.
http://www.microsoft.com/downloads/...4D-F30E-4E72-B531-75384A0F1C47&displaylang=en
 
In addition to the Exception Management Application Block, have a look at
the Logging Application Block.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag/html/Logging.asp
This uses the Enterprise Instrumentation Framework (EIF).

This is a more robust logging architecture. While it is still capable of
logging to the event log, if you want to use it that way, the Logging
Application Block can take configurable adapters to log to anyplace you'd
like (flat files, SQL Server, TCP messages, whatever). In addition, if a
log is not available, it can be configured to use a backup location.

It takes a little more work to use, but it is worth the effort if you really
want a fully thought-out logging solution.

--- Nick

BTW, Event logs can be configured so that they will discard old messages
rather than reject new ones. Also, you can set up your own event log to log
events from your application, making it easy to manage. I think this is
what Raghavendra was trying to say...


Raghavendra T V said:
Hi Gurminder,


Since you are saying that the log might get filledup you can also move the
contents of it to a backup file once it is full and notify the developer
through some mechanism.

Also have a look at the Microsoft Exception Management Block.
You can download it from the following link
http://www.microsoft.com/downloads/...FamilyID=8CA8EB6E-6F4A-43DF-ADEB-8F22CA173E02

Its a 600 Kb file

This gives you the option of logging errors into
-> System eventlog
-> Email notification ( error through email )
-> Database ( logging into database )

may be you can use a mixture of this depending on the scenario.

Also have a look at this
http://www.c-sharpcorner.com/ExceptionHandling.asp

interesting article to read on logging errors.
http://www.c-sharpcorner.com/Code/2003/Sept/CustomExceptionsUsingMSExpBlock.asp

Hope all this helps you in designing a better error logging mechanism.

Thanks
Raghavendra

David Levine said:
You can define your own backing store for the event log to reduce the
possibility of filling it up. Any logging you do has the potential of
overruning the store.
because,
in
production sceanrios, event logs can often go full and also in mulitple
application scenario, mangaing those become a headache.


:

Hi Gurminder,

I would suggest you to log errors in the System EventLog.
Logging errors to event log is faster than logging errors to a text file.
But if you application is yet to be deployed to production server.
I would suggest you to go for logging errors to text file and once
you
are
done with fixing
regularly occuring errors you will be limiting the errors that will be
logged to the text file.
then you can move the error logging to the System Event log.

Final conclusion: System Event logging is the best recommended if you
consider Performance, concurrency issues, production
scenarious, easy of data analysis & purging operations.

and also you have various 3rd party , some free tools for analysing the
system Event logs.

[For you knowledge: you can read the Microsoft - Improving .NET Application
Performance and Scalability.pdf ebook published by microsoft which
is available for free download . This book clearly mentions how to log
errors and where and which is the best one to go for.]

you can download the book from here.
http://www.microsoft.com/downloads/...4D-F30E-4E72-B531-75384A0F1C47&displaylang=en exceptions
 
Also look at http://logging.apache.org/log4net/

Regards,
Trilok.

Nick Malik said:
In addition to the Exception Management Application Block, have a look at
the Logging Application Block.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag/html/Logging.asp
This uses the Enterprise Instrumentation Framework (EIF).

This is a more robust logging architecture. While it is still capable of
logging to the event log, if you want to use it that way, the Logging
Application Block can take configurable adapters to log to anyplace you'd
like (flat files, SQL Server, TCP messages, whatever). In addition, if a
log is not available, it can be configured to use a backup location.

It takes a little more work to use, but it is worth the effort if you really
want a fully thought-out logging solution.

--- Nick

BTW, Event logs can be configured so that they will discard old messages
rather than reject new ones. Also, you can set up your own event log to log
events from your application, making it easy to manage. I think this is
what Raghavendra was trying to say...


Raghavendra T V said:
Hi Gurminder,


Since you are saying that the log might get filledup you can also move the
contents of it to a backup file once it is full and notify the developer
through some mechanism.

Also have a look at the Microsoft Exception Management Block.
You can download it from the following link
http://www.microsoft.com/downloads/...FamilyID=8CA8EB6E-6F4A-43DF-ADEB-8F22CA173E02
Its a 600 Kb file

This gives you the option of logging errors into
-> System eventlog
-> Email notification ( error through email )
-> Database ( logging into database )

may be you can use a mixture of this depending on the scenario.

Also have a look at this
http://www.c-sharpcorner.com/ExceptionHandling.asp

interesting article to read on logging errors.
http://www.c-sharpcorner.com/Code/2003/Sept/CustomExceptionsUsingMSExpBlock.asp
Hope all this helps you in designing a better error logging mechanism.

Thanks
Raghavendra

because,
will
be
logged to the text file.
then you can move the error logging to the System Event log.

Final conclusion: System Event logging is the best recommended if you
consider Performance, concurrency issues, production
scenarious, easy of data analysis & purging operations.

and also you have various 3rd party , some free tools for
analysing
the
system Event logs.

[For you knowledge: you can read the Microsoft - Improving .NET
Application
Performance and Scalability.pdf ebook published by microsoft which
is available for free download . This book clearly mentions how to log
errors and where and which is the best one to go for.]

you can download the book from here.
http://www.microsoft.com/downloads/...4D-F30E-4E72-B531-75384A0F1C47&displaylang=en
exceptions
 
Back
Top