Logging - Log4Net is engrained

Jan 26, 2012 at 10:18 AM

Hi - we don't use log4net for our logging - and I've had some trouble removing it as a dependency. In order to get around it I've had to:

  • Add a new member to the LogginMode enum:
        /// <summary>
        /// Uses the root logger as held by the LogUtil.GetRootLogger static property
        /// </summary>
  • Then in the AppServerBase I've modified GetLogger as follows:
	private void SetupLogger()
            switch (RootConfig.LoggingMode)
                case (LoggingMode.Root):
                Logger = LogUtil.GetRootLogger();

                case (LoggingMode.IndependantFile):
                    Logger = new DynamicLog4NetLogger(Config.Name);

                case (LoggingMode.Console):
                    Logger = new ConsoleLogger(Config.Name);

                    Logger = new Log4NetLogger(Config.Name);

This allows us to inject our own logger using the LogUtil.Setup command. Without the above changes, the logger is ignored. Please consider implementing this change in the main code base.

Please also consider abstracting out the log4net loggers into their own assembly - therefore removing it as a dependency and fully using the abstraction you have already put in place.


Jan 28, 2012 at 3:50 AM

In SuperSocket 1.5, the logging library will be replacable. You can choose log4net, Logging Application Block of Enterprise Library by yourself.

Jan 31, 2012 at 1:19 PM

Thanks - looking forward to it.