log4net not working

后端 未结 13 1713
轮回少年
轮回少年 2020-12-07 08:04

Hey I have this configuration in my web.config


    

        
13条回答
  •  忘掉有多难
    2020-12-07 09:05

    Also after some hours, I figured out why it wasn't working for me...

    i had:

    public static class Program
    {
    
        private static CommunicationManager _bcScanner = new CommunicationManager();
        private static ILog _log = LogManager.GetLogger(typeof(Program));
        private static SocketServer socketListener;
    

    but it should be:

    public static class Program
        {
            private static ILog _log = LogManager.GetLogger(typeof(Program));
            private static CommunicationManager _bcScanner = new CommunicationManager();
            private static SocketServer socketListener;
    

    So make sure the ILog is on the first line....

提交回复
热议问题