From c4fb128c722c5f1cd8e9c86c04ea4acb1a87ca22 Mon Sep 17 00:00:00 2001 From: Renaud Paquay Date: Fri, 3 Dec 2010 16:42:13 -0800 Subject: [PATCH] Fix intermitent bug with injecting ILogger --HG-- branch : dev --- src/Orchard/Logging/ILogger.cs | 2 +- src/Orchard/Logging/LoggingModule.cs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Orchard/Logging/ILogger.cs b/src/Orchard/Logging/ILogger.cs index 6e7963609..045db2ef8 100644 --- a/src/Orchard/Logging/ILogger.cs +++ b/src/Orchard/Logging/ILogger.cs @@ -9,7 +9,7 @@ namespace Orchard.Logging { Fatal } - public interface ILogger : ISingletonDependency { + public interface ILogger { bool IsEnabled(LogLevel level); void Log(LogLevel level, Exception exception, string format, params object[] args); } diff --git a/src/Orchard/Logging/LoggingModule.cs b/src/Orchard/Logging/LoggingModule.cs index de55b5017..28bd26b70 100644 --- a/src/Orchard/Logging/LoggingModule.cs +++ b/src/Orchard/Logging/LoggingModule.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Reflection; @@ -14,7 +15,7 @@ namespace Orchard.Logging { private readonly IDictionary _loggerCache; public LoggingModule() { - _loggerCache = new Dictionary(); + _loggerCache = new ConcurrentDictionary(); } protected override void Load(ContainerBuilder moduleBuilder) { @@ -78,7 +79,7 @@ namespace Orchard.Logging { else { var propertyValue = ctx.Resolve(new TypedParameter(typeof(Type), componentType)); _loggerCache.Add(component, propertyValue); - propertyInfo.SetValue(instance, propertyValue, null); + propertyInfo.SetValue(instance, propertyValue, null); } }; }