I am using Nido Framework to develop my ASP.NET Web Application. It has a default mode to log all errors occurred in back end layer. But now I want to handle page level exceptions and log them as well. Can I use the same framework to do that or do I have to find some other means?
Any help would be greatly appreciated
If you want to log errors in a class, then you can derive that class from ' LoggerBase ' as below do exception logging..
public class PaymentGatewayWrapper : LoggerBase
{
protected override Type LogPrefix
{
get { return this.GetType(); }
}
public void ProcessPayment(Object paymentInfo, Object customer,
Guid orderGuid, ref Object processPaymentResult)
{
try
{
// TODO: Required operational level code
}
catch (System.Exception ex)
{
this.LogError("Error processing payment", ex);
}
}
}
However if you want to do this via a web page. You will don't have the option to derive it from a custom class. Then you can take another path as below...
new LogManager(this.GetType()).LogError("This is a test error", ex);
Additional references
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.