/// <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; }
public LoggerBase(Type name) { log = LogManager.GetLogger(name); Logger = log.Logger; Logger.Repository.ConfigurationChanged += LoggerRepositoryConfigurationChanged; ReloadLevels(Logger.Repository); }
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); }
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; }
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); }
/// <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) { }
/// <summary> /// 初始化一个<see cref="Log4NetLog"/>类型的新实例 /// </summary> public Log4NetLog(ILoggerWrapper wrapper) { _logger = wrapper.Logger; }
public Log4netLogger(log4net.Core.ILogger logger, Log4netFactory factory) { Logger = logger; Factory = factory; }
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)); }
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); }
public QMLogger(log4net.Core.ILogger log) { _logger = log; }
public CoeveryLog4netLogger(log4net.Core.ILogger logger, CoeveryLog4netFactory factory) { CoeveryHostContainerRegistry.RegisterShim(this); Logger = logger; Factory = factory; }
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; }
/// <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; }
/// <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)); }
public Log4netLogger(log4net.Core.ILogger logger) { Guard.NotNull(logger, nameof(logger)); _logger = logger; }
internal Log4NetLog(ILoggerWrapper wrapper) { _logger = wrapper.Logger; }
/// <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)); }
public OrchardLog4netLogger(log4net.Core.ILogger logger, OrchardLog4netFactory factory) { Logger = logger; Factory = factory; }
internal Log4NetLogger(ILoggerWrapper wrapper) { _logger = wrapper.Logger; }
/// <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; }
public OrchardLog4netLogger(log4net.Core.ILogger logger, OrchardLog4netFactory factory) { OrchardHostContainerRegistry.RegisterShim(this); Logger = logger; Factory = factory; }
public DefaultLog4netLogger(log4net.Core.ILogger logger, DefaultLog4netFactory factory) { Logger = logger; Factory = factory; }
/// <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)); }
public ExtLogImpl(log4net.Core.ILogger logger) : base(logger) { }