I need a solution for logging errors so that we can send a "friendly" message to users, but capture exception details to troubleshoot ....
I'm looking into ways to send errors to windows server error logs ... but am also interested in open source solutions or a product I can suggest to the "governance powers that be" for purchase.
Steve
To my knowledge, the two most common logging frameworks are Enteprise Library and log4net.
Thanks, RL ... but what about "normalizing this behavior" ?? ... I'd prefer not having to have complex logic in each BO to handle this .....
Where would I put code in one place that would
1) persist exception information to error log
2) send a friendly message to presentation layer ( could be a property of the BO that is returned )
So no try/catch in the presentation layer .... just test for a return value in the BO returned from the function call.
When BO is returned from call (to DataPortal) the BO would know to either
Thanks,
Steve
thinking out loud re: "normalizing behavior" ...
I could have an exception handler class that would be called in the catch method of DataPortal / potential source of error call ... so
If no exception ... returns normally
if exception ... passes exception to exception handler ...
makes sense ??
In you can override the BusinessBase.DataPortal_OnDataPortalException method (and the same in other classes) to be notified when an exception occurred during server-side processing.
If you have custom base classes for all the CSLA base class types (which is a good idea), then you can just override this method in your base classes to have pretty centralized handling of exceptions.
If you are using object factories, your factory objects should implement a public InvokeError(Exception) method to be notified of an exception. You can have a custom factory base class (subclass of Csla.Server.ObjectFactory) to do this for all your factory objects.
Well, what you are describing is possible in CSLA 4.0.x. See http://lhotka.net/cslabugs/edit_bug.aspx?id=679
The intention is foremost:
a) Replace NonSerializable exception with a generic exception
b) Replace a DAL specific Exception that is not available on the client (ex custom DB Drivers, MQ Exceptions etc) with a generic exception.
c) Centralized logging of all DataPortal exceptions in one class.
See the .NET/cs sample CusomErrorHandling.
Hi,
You should also add NLog to your shortlist of logging framework.
If you are going to consider a commercial product then take look at Gibraltar
In general terms - in my apps I have created several exception types that I throw and have a general ExceptionWindows that will either display a "nice" message if based on UserFriendlyException otherwise will show a full stack trace.
And we have a custom exception logging service that logs the exception details for troubleshooting. NLog shows a really simple way of implementing this.
Copyright (c) Marimer LLC