elmah throws a signal, difference with real exception when I look at the log
When I throw a signal to Elmah, it catches it, then I can开发者_如何学JAVA find the exception via Elmah.axd page, my questions is, on the elmah.axd page, can I tell if the exception is from a signal or a really exception there, from the log?
The best way to sort these is to create a custom exception. We use one called "LogMessageException". Whenever we are just signaling some logging information we use this.
That way we can filter out the logging noise from the real exceptions.
update with sample class and call:
public class LogMessageException : Exception {
private LogMessageException() : base() {
} // privatizing original constructor
public LogMessageException( String message ) : base(message) {
} //
} // class::LogMessageException
Sample Call
Elmah.ErrorSignal.FromCurrentContext().Raise(new LogMessageException("Say something here"));
精彩评论