A common approach to create a log entry using the following code-
LogEntry entry = new LogEntry(); entry.Message = "I am logging"; Logger.Write(entry);This works fine with Enterprise Library 5.0. But in 6.0 it gives the error in the title. We can solve this by the following-
Logger.SetLogWriter(new LogWriterFactory().Create()); LogEntry entry = new LogEntry(); entry.Message = "I am logging"; Logger.Write(entry);Or we can also try-
IConfigurationSource configurationSource = ConfigurationSourceFactory.Create(); LogWriterFactory logWriterFactory = new LogWriterFactory(configurationSource); Logger.SetLogWriter(logWriterFactory.Create()); LogEntry entry = new LogEntry(); entry.Message = "I am logging"; Logger.Write(entry);