Я стараюсь, чтобы плавная конфигурация работала без успеха. Я получаю следующее сообщение об ошибке: ПроизошлаПроблема с свободной конфигурацией
Ошибка активации при попытке получить экземпляр типа LogWriter, ключ ""
, когда я пытаюсь получить доступ к LogWriter:
Dim logwriter As LogWriter = EnterpriseLibraryContainer.Current.GetInstance(Of LogWriter)()
Конфигурация:
Dim formatBuilder As New FormatterBuilder()
Dim builder As New ConfigurationSourceBuilder()
builder.ConfigureInstrumentation().EnableLogging()
builder.ConfigureLogging.LogToCategoryNamed("Important") _
.WithOptions.SetAsDefaultCategory() _
.SendTo.RollingFile("StandardListener") _
.RollEvery(RollInterval.Midnight) _
.RollAfterSize(50000) _
.WhenRollFileExists(RollFileExistsBehavior.Increment) _
.FormatWith(formatBuilder.CustomFormatterNamed("StandardFormatter", GetType(StandardFormatter))) _
.ToFile("D:\LogFiles\" + fileName)
Обновление
Я добавил
var configSource = new DictionaryConfigurationSource();
builder.UpdateConfigurationWithReplace(configSource);
EnterpriseLibraryContainer.Current
= EnterpriseLibraryContainer.CreateDefaultContainer(configSource);
Я до сих пор не могу получить LogWriter и Logger
в LAB не удается получить его слишком (он использует EnterpriseLibraryContainer.Current.GetInstance<LogWriter>()
внутренне);
Любые предложения?
Я все еще не могу заставить его работать. – jgauffin