WPF、Prism、UnityBootTrapper和企业库日志记录设置引发LogWriter异常

WPF、Prism、UnityBootTrapper和企业库日志记录设置引发LogWriter异常,wpf,prism,unity-container,enterprise-library,Wpf,Prism,Unity Container,Enterprise Library,我只是想站起来,习惯于使用Prism,在我的引导程序中,我有: public class Bootstrapper : UnityBootstrapper { private readonly EnterpriseLibraryLoggerAdapter _logger = new EnterpriseLibraryLoggerAdapter(); protected override void InitializeShell() { base.

我只是想站起来,习惯于使用Prism,在我的引导程序中,我有:

public class Bootstrapper : UnityBootstrapper
{

    private readonly EnterpriseLibraryLoggerAdapter _logger =  new EnterpriseLibraryLoggerAdapter();  

    protected override void InitializeShell()
    {
        base.InitializeShell();

        Application.Current.MainWindow = (Shell)this.Shell;
        Application.Current.MainWindow.Show();
    }

    protected override DependencyObject CreateShell()
    {
        return this.Container.Resolve<Shell>();
    }

    protected override ILoggerFacade CreateLogger()
        {
              return _logger; 
        }
和日志适配器

public class EnterpriseLibraryLoggerAdapter : ILoggerFacade
{
    #region ILoggerFacade Members

    public void Log(string message, Category category, Priority priority)
    {
        Logger.Write(message, category.ToString(), (int)priority); // <--Blows up here 
    }

    #endregion
}

下面是StockTraderRI示例应用程序。我是否丢失了某个注册?

将配置移到了我的引导程序构造函数中,一切似乎正常

 var builder = new ConfigurationSourceBuilder();
        builder.ConfigureLogging()
            .WithOptions
            .DoNotRevertImpersonation()
            .LogToCategoryNamed("Debug")
            .SendTo.FlatFile("Basic Log File")
            .FormatWith(new FormatterBuilder()
                            .TextFormatterNamed("Text Formatter")
                            .UsingTemplate(
                                "Timestamp: {timestamp}{newline}Message: {message}{newline}Category: {category}{newline}"))
            .ToFile("core.log")
            .SendTo.RollingFile("Rolling Log files")
            .RollAfterSize(1024)
            .ToFile("RollingTest.log")
            .LogToCategoryNamed("General")
                .WithOptions.SetAsDefaultCategory()
                .SendTo.SharedListenerNamed("Basic Log File");

        var configSource = new DictionaryConfigurationSource();
        builder.UpdateConfigurationWithReplace(configSource);
        EnterpriseLibraryContainer.Current = EnterpriseLibraryContainer.CreateDefaultContainer(configSource);
The type LogWriter does not have an accessible constructor.
 var builder = new ConfigurationSourceBuilder();
        builder.ConfigureLogging()
            .WithOptions
            .DoNotRevertImpersonation()
            .LogToCategoryNamed("Debug")
            .SendTo.FlatFile("Basic Log File")
            .FormatWith(new FormatterBuilder()
                            .TextFormatterNamed("Text Formatter")
                            .UsingTemplate(
                                "Timestamp: {timestamp}{newline}Message: {message}{newline}Category: {category}{newline}"))
            .ToFile("core.log")
            .SendTo.RollingFile("Rolling Log files")
            .RollAfterSize(1024)
            .ToFile("RollingTest.log")
            .LogToCategoryNamed("General")
                .WithOptions.SetAsDefaultCategory()
                .SendTo.SharedListenerNamed("Basic Log File");

        var configSource = new DictionaryConfigurationSource();
        builder.UpdateConfigurationWithReplace(configSource);
        EnterpriseLibraryContainer.Current = EnterpriseLibraryContainer.CreateDefaultContainer(configSource);