예제 #1
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="JsonL4NLogger" /> class.
 /// </summary>
 public JsonL4NLogger()
 {
     XmlConfigurator.Configure();
     this.log4NetLogger = LoggerManager.GetLogger(this.GetType().Assembly, this.GetType().Name);
     ////this.log4NetLogger = LoggerManager.GetLogger(this.GetType().Assembly, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
     this.loggerName = this.GetType().Name;
 }
        public JsonL4NLogger()
        {
            XmlConfigurator.Configure();
            this.log4NetLogger = LoggerManager.GetLogger(this.GetType().Assembly, this.GetType().Name);

            this.loggerName = this.GetType().Name;
        }
예제 #3
0
 public LoggerBase(Type name)
 {
     log    = LogManager.GetLogger(name);
     Logger = log.Logger;
     Logger.Repository.ConfigurationChanged += LoggerRepositoryConfigurationChanged;
     ReloadLevels(Logger.Repository);
 }
예제 #4
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="JsonL4NLogger" /> class.
 /// </summary>
 public JsonL4NLogger()
 {
     XmlConfigurator.Configure();
     this.log4NetLogger = LoggerManager.GetLogger(this.GetType().Assembly, this.GetType().Name);
     ////this.log4NetLogger = LoggerManager.GetLogger(this.GetType().Assembly, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
     this.loggerName = this.GetType().Name;
 }
예제 #5
0
        public OrchardLog4netLogger(log4net.Core.ILogger logger, OrchardLog4netFactory factory)
        {
            OrchardHostContainerRegistry.RegisterShim(this);
            Logger  = logger;
            Factory = factory;

            _shellSettings = new Lazy <ShellSettings>(LoadSettings);
        }
        public OrchardLog4netLogger(log4net.Core.ILogger logger, OrchardLog4netFactory factory)
        {
            OrchardHostContainerRegistry.RegisterShim(this);
            Logger  = logger;
            Factory = factory;

            _shellSettings = new Lazy <ShellSettings>(LoadSettings, System.Threading.LazyThreadSafetyMode.PublicationOnly);
        }
예제 #7
0
        protected Log4NetLogger(LevelEnum level, Type type, string loggerName)
        {
            DeclaringType = type;
            Level         = GetLevel(level);

            loggerName = this.GetLoggerName(type, loggerName);

            Logger = string.IsNullOrWhiteSpace(loggerName)
                                ? LogManager.GetLogger(type).Logger
                                : LogManager.GetLogger(type.Assembly, loggerName).Logger;
        }
예제 #8
0
        static LogRecord()
        {
            GlobalContext.Properties["InstanceName"] = Process.GetCurrentProcess().Id;
            var loggers      = LoggerManager.GetCurrentLoggers(Assembly.GetCallingAssembly());
            var loggerSystem = loggers.SingleOrDefault(f => f.Name.Equals("LoggerNameSystem", StringComparison.OrdinalIgnoreCase));

            if (loggerSystem == null)
            {
                loggerSystem = loggers.FirstOrDefault(t => t.Name.Equals("LoggerNameRecordData", StringComparison.InvariantCultureIgnoreCase) == false);
            }
            logger  = loggerSystem;
            logType = typeof(LogRecord);
        }
예제 #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TraceLogImpl" /> class.
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <remarks></remarks>
 public TraceLogImpl(log4net.Core.ILogger logger)
     : base(logger)
 {
 }
예제 #10
0
 /// <summary>
 /// 初始化一个<see cref="Log4NetLog"/>类型的新实例
 /// </summary>
 public Log4NetLog(ILoggerWrapper wrapper)
 {
     _logger = wrapper.Logger;
 }
예제 #11
0
 public Log4netLogger(log4net.Core.ILogger logger, Log4netFactory factory)
 {
     Logger  = logger;
     Factory = factory;
 }
예제 #12
0
 public override void Log(Type source, Module.Logger.Level level, object @object, Exception exception)
 {
     _logger = _logger ?? LoggerManager.GetLogger(Assembly.GetExecutingAssembly(), Owner);
     // level - slow
     _logger.Log(Owner, new log4net.Core.Level(level.Value, level.Name), @object, exception);
 }
 /// <summary>
 /// Lookup the wrapper object for the logger specified
 /// </summary>
 /// <param name="logger">the logger to get the wrapper for</param>
 /// <returns>the wrapper for the logger specified</returns>
 private static ITraceLog WrapLogger(log4net.Core.ILogger logger)
 {
     return((ITraceLog)s_wrapperMap.GetWrapper(logger));
 }
예제 #14
0
        public void Setup()
        {
            correlation = new Correlation(CorrelationId, CallerId);
            log = Substitute.For<ILog>();
            logger = Substitute.For<log4net.Core.ILogger>();
            log.Logger.Returns(logger);

            repository = Substitute.For<ILoggerRepository>();
            repository.GetLogger(source.GetType()).Returns(log);

            sut = new LogWriter(repository, source);
        }
예제 #15
0
파일: QMLogger.cs 프로젝트: radtek/QM
 public QMLogger(log4net.Core.ILogger log)
 {
     _logger = log;
 }
 public CoeveryLog4netLogger(log4net.Core.ILogger logger, CoeveryLog4netFactory factory)
 {
     CoeveryHostContainerRegistry.RegisterShim(this);
     Logger  = logger;
     Factory = factory;
 }
예제 #17
0
 public Log4NetLogger(string loggername)
 {
     _logger = log4net.LogManager.GetLogger(loggername).Logger;
 }
 public TurkuazLog4NetLogger(Type loggerType)
 {
     _logger = LogFactory.GetInternalLogger(loggerType).Logger;
 }
 public TurkuazLog4NetLogger(string loggerName)
 {
     _logger = LogFactory.GetInternalLogger(loggerName).Logger;
 }
예제 #20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Log4NetLogger"/> class.
 /// </summary>
 /// <param name="options">The log4net provider options.</param>
 public Log4NetLogger(Log4NetProviderOptions options)
 {
     this.options = options ?? throw new ArgumentNullException(nameof(options));
     this.logger  = LogManager.GetLogger(options.LoggerRepository, options.Name).Logger;
 }
예제 #21
0
 /// <summary>
 /// Initializes a new instance of the Log4NetLogger class.
 /// </summary>
 public Log4NetLogger(log4net.Core.ILogger logger)
 {
     _logger = logger;
 }
 /// <summary>
 /// Method to create the <see cref="ILoggerWrapper"/> objects used by
 /// this manager.
 /// </summary>
 /// <param name="logger">The logger to wrap</param>
 /// <returns>The wrapper for the logger specified</returns>
 private static ILoggerWrapper WrapperCreationHandler(log4net.Core.ILogger logger)
 {
     return(new TraceLogImpl(logger));
 }
예제 #23
0
        public Log4netLogger(log4net.Core.ILogger logger)
        {
            Guard.NotNull(logger, nameof(logger));

            _logger = logger;
        }
예제 #24
0
 internal Log4NetLog(ILoggerWrapper wrapper)
 {
     _logger = wrapper.Logger;
 }
예제 #25
0
        /// <summary>
        /// Creates the logger for the specified type.
        /// </summary>
        /// <param name="type">System.Type to create the logger for.</param>
        /// <returns>The logger for the specified type.</returns>
        public ILogger CreateFor(Type type)
        {
            log4net.Core.ILogger logger = LoggerManager.GetLogger(type.Assembly, type);

            return(new Log4NetLogger(logger));
        }
예제 #26
0
 public OrchardLog4netLogger(log4net.Core.ILogger logger, OrchardLog4netFactory factory)
 {
     Logger  = logger;
     Factory = factory;
 }
예제 #27
0
 /// <summary>
 /// 初始化一个<see cref="Log4NetLog"/>类型的新实例
 /// </summary>
 public Log4NetLog(ILoggerWrapper wrapper)
 {
     _logger = wrapper.Logger;
 }
예제 #28
0
 internal Log4NetLogger(ILoggerWrapper wrapper)
 {
     _logger = wrapper.Logger;
 }
예제 #29
0
 /// <summary>
 /// Wrap an instance of an log4net logger
 /// </summary>
 /// <param name="logger">log4net logger to wrap</param>
 public Log4NetLogger(ILog logger)
 {
     this.logger = logger.Logger;
 }
예제 #30
0
 public OrchardLog4netLogger(log4net.Core.ILogger logger, OrchardLog4netFactory factory)
 {
     OrchardHostContainerRegistry.RegisterShim(this);
     Logger  = logger;
     Factory = factory;
 }
예제 #31
0
 public DefaultLog4netLogger(log4net.Core.ILogger logger, DefaultLog4netFactory factory)
 {
     Logger  = logger;
     Factory = factory;
 }
예제 #32
0
        /// <inheritdoc/>
        public LoggingEvent CreateLoggingEvent <TState>(MessageCandidate <TState> messageCandidate, log4net.Core.ILogger logger, Log4NetProviderOptions options)
        {
            Type   callerStackBoundaryDeclaringType = typeof(LoggerExtensions);
            string message  = messageCandidate.Formatter(messageCandidate.State, messageCandidate.Exception);
            Level  logLevel = options.LogLevelTranslator.TranslateLogLevel(messageCandidate.LogLevel, options);

            if (logLevel == null || (string.IsNullOrEmpty(message) && messageCandidate.Exception == null))
            {
                return(null);
            }

            return(new LoggingEvent(
                       callerStackBoundaryDeclaringType: callerStackBoundaryDeclaringType,
                       repository: logger.Repository,
                       loggerName: logger.Name,
                       level: logLevel,
                       message: message,
                       exception: messageCandidate.Exception));
        }
예제 #33
0
 public ExtLogImpl(log4net.Core.ILogger logger)
     : base(logger)
 {
 }