using System.Collections.Concurrent; namespace APT.Infrastructure.Core { /// /// Logger管理器 /// public static class LoggerManager { private static readonly ConcurrentDictionary Loggers; private static readonly object LockObj = new object(); static LoggerManager() { Loggers = new ConcurrentDictionary(); } public static ILog4netLogger GetLogger() { return GetLogger("Application"); } public static ILog4netLogger GetLogger(string name) { ILog4netLogger logger; if (Loggers.TryGetValue(name, out logger)) { return logger; } logger = new Log4netLogger(name); Loggers[name] = logger; return logger; } } }