拙网论坛

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 231|回复: 0

Log4net

[复制链接]

949

主题

1001

帖子

3736

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
3736
发表于 2018-12-2 00:14:42 | 显示全部楼层 |阅读模式
研究一下Log4Net的架构及应用。
执行过程
1 LoggingService.Debug(string.Format(“{0}-{1}”, msg.MessageType, msg.Operate));
2 Service.Debug(message);
3 sealed class log4netLoggingService : ILoggingService :
log.Debug(message);
4 LogImpl:
Logger.Log(ThisDeclaringType, m_levelDebug, message, null);
5 Logger.cs:
virtual public void Log(Type callerStackBoundaryDeclaringType, Level level, object message, Exception exception)
{
try
{
if (IsEnabledFor(level))
{
ForcedLog((callerStackBoundaryDeclaringType != null) ? callerStackBoundaryDeclaringType : declaringType, level, message, exception);
}
}
catch (Exception ex)
{
log4net.Util.LogLog.Error(declaringType, “Exception while logging”, ex);
}
}
6 ForcedLog
ForcedLog((callerStackBoundaryDeclaringType != null) ? callerStackBoundaryDeclaringType : declaringType, level, message, exception);
7 Logger.cs
CallAppenders
8 LoggingEvent
private ILoggerRepository m_repository = null;

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|抱朴守拙BBS

GMT+8, 2025-5-26 06:27 , Processed in 0.196066 second(s), 18 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表