Logging with Elmah

Showing 1-4 of 4 messages
Logging with Elmah Ethan Blyth 8/9/12 9:14 AM
Hi guys,

I am trying to get some simple exception logging up and running on my box but I'm struggling and hope you can point me in the right direction.

I basically want to be able to browse ELMAH errors like it says here http://johan.driessen.se/posts/simple-exception-logging-with-elmah

I've read the ServiceStack logging overview here http://www.servicestack.net/docs/logging/logging-overview but I can't work out what I need to put in the SetConfig() section of the app startup?


I have:

SetConfig(new EndpointHostConfig {
                DebugMode = true//Show StackTraces when developing
                LogFactory = new ElmahLogFactory()
			});

but ElmahLogFactory expects its an ILogFactory in the constructor but it itself is an ILogFactory. I'm not sure what to put in there apart from creating my own class that implements ILogFactory. If I do that I end up with a GetLogger method and then I have to create another class that implements ILog. I haven't filled in any details yet as I felt I was going down the wrong road.

Can someone help a brother out so I can view exceptions in my elmah.axd (I will modify this page address don't worry).


Thanks in advance,

Ethan



Re: Logging with Elmah Arxisos 8/10/12 2:53 AM
Hi Ethan,

"Only Error and Fatal are passed along to Elmah, while all other errors will be written to the wrapped logger."

If you want to tweak this behavior, you should be able to do that by changing the Elmah log factory source code:  https://github.com/ServiceStack/ServiceStack.Logging/tree/master/src/ServiceStack.Logging.Elmah 

Cheers,
Steffen
Re: [ServiceStack] Re: Logging with Elmah Jon Canning 8/10/12 4:28 AM
Just installing Elmah from NuGet should set up exception logging. If you want to use Elmah for general purpose logging then try this approach:

Re: [ServiceStack] Logging with Elmah Ephraim Mower 8/10/12 6:51 AM
The Elmah log factory you're using is only a supplement to whatever other logger you are using, which is why it takes an ILog (your standard logger - log4net, etc.) in the constructor. Your standard logger takes care of typical logging, and Elmah only receives Error and Fatal.