Esempio n. 1
0
        public Service1()
        {
            InitializeComponent();

            //The logger initialization only needs to be performed ONCE during runtime, so put it at the beginning of an executable or something. You
            //don't need to perform this per-class
            Log4NetExtensions.SetupDebugLogger("TestService");
            Log4NetExtensions.SetLog4NetAsDefaultLogger();

            //THIS needs to be performed per-class in order to get a logger that acts as a proxy to the default logger you setup earlier. Updating the default
            //logger will automatically update all proxy loggers, so don't worry about the order.
            Logger = LogServices.CreateLoggerFromDefault(this.GetType());
        }
        public UnitTestBase(string name = null)
        {
            if (name == null)
            {
                name = this.GetType().Name;
            }

            TestName = name;

            Log4NetExtensions.SetupDebugLogger($"Unit_{name}");
            Log4NetExtensions.SetLog4NetAsDefaultLogger();
            Logger = LogServices.CreateLoggerFromDefault(name);
        }