예제 #1
0
        public static ILog GetLogger(Type type)
        {
            if (logger == null)
            {
                NameValueCollection properties = new NameValueCollection();
                properties.Add("configType", "FILE-WATCH");
                properties.Add("configFile", @"Resources\log4net.config");
                Log4NetLoggerFactoryAdapter adapter = new Log4NetLoggerFactoryAdapter(properties);

                logger = adapter.GetLogger(type);
            }
            return(logger);
        }
예제 #2
0
        public void TestSetUp()
        {
            _log4NetLoggerFactoryAdapter  = new Log4NetLoggerFactoryAdapter(new NameValueCollection());
            _nLogLoggerFactoryAdapter     = new NLogLoggerFactoryAdapter(new NameValueCollection());
            _multipleLoggerFactoryAdapter = new MultiLoggerFactoryAdapter();

            _multipleLoggerFactoryAdapter.LoggerFactoryAdapters.Add(_log4NetLoggerFactoryAdapter);
            _multipleLoggerFactoryAdapter.LoggerFactoryAdapters.Add(_nLogLoggerFactoryAdapter);

            //these tests will only work if all of the loggers actually *support* VariablesContext with other than the No-Op 'placeholder'
            Assume.That(_log4NetLoggerFactoryAdapter.GetLogger(typeof(MultipleLoggerGlobalVariableContextTests)).GlobalVariablesContext, Is.Not.InstanceOf <NoOpVariablesContext>());
            Assume.That(_nLogLoggerFactoryAdapter.GetLogger(typeof(MultipleLoggerGlobalVariableContextTests)).GlobalVariablesContext, Is.Not.InstanceOf <NoOpVariablesContext>());
        }