wrong file and line in log4net wrapper

回眸只為那壹抹淺笑 提交于 2019-12-06 14:05:30

this is by design, if you are interested in line and file where an exception is thrown in the first place you should log the exception object or its stacktrace member, if you have configured the log4net file appender to show the file and line where the message is been written from, it is normal that you find your wrapper, but when logging exceptions and stacktrace you will find the correct content.

in our appenders we have the following, so we do not even show the wrapper class name or file/line...

<log4net>
<appender name="FileAppender" type="log4net.Appender.RollingFileAppender">
    <threshold value="ALL"/>
    <immediateFlush>true</immediateFlush>
    <lockingModel type="log4net.Appender.FileAppender+MinimalLock"/>
    <encoding value="utf-8"/>
    <file value="D:\Axis\RPP\Logs\myLogFile.log" />
    <appendToFile value="true"/>
    <rollingStyle value="Date" />
    <maxSizeRollBackups value="30" />
    <maximumFileSize value="25MB" />
    <staticLogFileName value="true"/>
    <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="[%property{log4net:HostName}] - %username%newline%utcdate - %-5level - %message%newline"/>
    </layout>
</appender>

<root>
    <priority value="ALL"/>
    <appender-ref ref="FileAppender"/>
</root>

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!