简体   繁体   English

log4net的错误消息在日志文件中被截断

[英]Error message of log4net is truncated in log file

I have these code: 我有以下代码:

class Program
{
    protected static ILog logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

    static void Main(string[] args)
    {
        try
        {
            throw new Exception("1234567890abcdefghijklmnopqrstuvwxyz");
        }
        catch (Exception exception)
        {
            logger.Error("error", exception);
        }
    }
}

when I run it from my computer, visual studio, the error in log file is 当我从计算机Visual Studio中运行它时,日志文件中的错误是

2019-09-12 14:07:19,302 [10] ERROR InspectionEmail.Program [(null)] - error System.Exception: 1234567890abcdefghijklmnopqrstuvwxyz at InspectionEmail.Program.Main(String[] args) in D:\\TFS\\XXXXXX\\Manufacturing\\Main\\PartsTracking\\InspectionEmail\\InspectionEmail\\Program.cs:line 30 2019-09-12 14:07:19,302 [10]错误InspectionEmail.Program [[null)]-错误System.Exception:D:\\ TFS \\ XXXXXX \\ Manufacturing中的InspectionEmail.Program.Main(String [] args)处的1234567890abcdefghijklmnopqrstuvwxyz \\ Main \\ PartsTracking \\ InspectionEmail \\ InspectionEmail \\ Program.cs:第30行

when I run it from server, the error in log file is 当我从服务器运行它时,日志文件中的错误是

2019-09-12 14:06:55,744 [1] ERROR InspectionEmail.Program [ 2019-09-12 14:06:55,744 [1]错误InspectionEmail.Program [

why is that? 这是为什么? what went wrong? 什么地方出了错?

try checking if the web config part matches locally and on the server, specifically check the MaxSizeRollBackups, 尝试检查Web配置部件是否在本地和服务器上匹配,特别是检查MaxSizeRollBackups,

  <MaxSizeRollBackups value="-1" />

Also check the maximumFileSize is not set to something very small on the server 还要检查在服务器上没有将maximumFileSize设置为很小的值

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM