Please use. NET 5,. NET 6, NET 7,. NET 8, NET Framework 4.6, NET Framework 4.61, NET Framework 4.7, NET Framework 4.72, NET Framework 4.8, NET Framework 4.81, and. NET Core 3.1 versions

LoggerManager 类

Provides centralized logging management for the application using log4net 使用 log4net 提供应用程序的集中日志管理

Definition

命名空间: DeploySharp.Log
程序集: DeploySharp (在 DeploySharp.dll 中) 版本:0.0.4+6e8a2e904469617cd59619d666c0e272985c0e33
C#
public static class LoggerManager
Inheritance
Object    LoggerManager

备注

Thread-safe singleton implementation for logging configuration and management. Supports multiple output targets and log levels with flexible configuration.

线程安全的单例实现,用于日志配置和管理。 支持多种输出目标和日志级别,具有灵活的配置。

示例

Basic initialization:
C#
LoggerManager.Initialize(LogLevel.DEBUG, LogOutput.All);
LoggerManager.ProjectMainLogger.Info("Application started");

构造函数

LoggerManager Static constructor ensures logger is ready after class load 静态构造函数确保类加载后日志记录器就绪

方法

ConvertLevel Converts custom LogLevel to log4net.Core.Level 将自定义LogLevel转换为log4net.Core.Level
Initialize Initializes logging system with specified configuration 使用指定配置初始化日志系统
InitializeDefault Initializes logger with default settings (DEBUG level, Console output) 使用默认设置(DEBUG级别,控制台输出)初始化日志记录器
IsInitialized Checks if logging system is initialized 检查日志系统是否已初始化

字段

_isInitialized Flag indicating whether logging system has been initialized 指示日志系统是否已初始化的标志
_lock Lock object for thread-safe initialization 用于线程安全初始化的锁对象
ProjectMainLogger The main logger instance for the project 项目的主日志记录器实例

参见