Skip to content

Instantly share code, notes, and snippets.

@dvdstelt
Last active May 26, 2016 10:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dvdstelt/409d2d81863ec1f6824a8a4fd7bf6e10 to your computer and use it in GitHub Desktop.
Save dvdstelt/409d2d81863ec1f6824a8a4fd7bf6e10 to your computer and use it in GitHub Desktop.
Endpoint configuration for logging everything
using System;
using NServiceBus;
using NServiceBus.Hosting.Profiles;
using NServiceBus.Log4Net;
using NServiceBus.Logging;
public class EndpointConfig : IConfigureThisEndpoint
{
public EndpointConfig()
{
var appDomainLogger = LogManager.GetLogger("AppDomain");
AppDomain.CurrentDomain.FirstChanceException += (o, ea) => { appDomainLogger.Debug("FirstChanceException", ea.Exception); };
AppDomain.CurrentDomain.UnhandledException += (o, ea) => { appDomainLogger.Debug("UnhandledException", ea.ExceptionObject as Exception); };
}
void IConfigureThisEndpoint.Customize(BusConfiguration busConfiguration)
{
busConfiguration.EndpointName("Samples.NServiceBus");
busConfiguration.UseSerialization<JsonSerializer>();
busConfiguration.UsePersistence<InMemoryPersistence>();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment