Logging - Log4Net is engrained

Jan 26, 2012 at 9: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>
        Root
  • Then in the AppServerBase I've modified GetLogger as follows:
	private void SetupLogger()
        {
            switch (RootConfig.LoggingMode)
            {
                case (LoggingMode.Root):
                Logger = LogUtil.GetRootLogger();
                    break;

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

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

                default:
                    Logger = new Log4NetLogger(Config.Name);
                    break;
            }
        }

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.

Thanks

Coordinator
Jan 28, 2012 at 2: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 12:19 PM

Thanks - looking forward to it.