Giedrius
Giedrius

Reputation: 8540

Error handler in Azure Websites does not log all exceptions

I have a site, that uses StackExchange.Exceptional to log exceptions. Problem is, that it does not log all exceptions, like on my development machine.

If it would not log any exceptions, I would think that some configuration/permissions are not working on Azure Websites, may be module is not loaded/working, but for example if I misstype controller action, I get an exception logged:

A public action method 'Logi' was not found on controller 'Acme.Controllers.AccountController'.

I've tried running site using release configuration localy, it works without problem.

As I understand, StackExchange.Exceptional is http module, that is logging unhandled exceptions using this code:

  protected virtual void OnError(object sender, EventArgs args)
  {
        var app = (HttpApplication)sender;
        var ex = app.Server.GetLastError();

        LogException(ex, app.Context);
  }

(https://github.com/NickCraver/StackExchange.Exceptional/blob/master/StackExchange.Exceptional/ExceptionalModule.cs#L36)

May be in some cases on Windows Azure it does not receive OnError event, any ideas what to check, where to search for a clue?

Upvotes: 3

Views: 345

Answers (1)

Giedrius
Giedrius

Reputation: 8540

I've managed to replicate the same behaviour on local machine with added this setting:

<customErrors mode="On">

As long as RemoteOnly mode is default, I wasn't seeing problem on local development machine. Not sure why, but when customErrors are enabled, some exceptions were not logged through http handler.

Upvotes: 1

Related Questions