public static void DefaultCategoryTest() { global::log4net.Tests.Appender.CategoryTraceListener categoryTraceListener = new global::log4net.Tests.Appender.CategoryTraceListener(); // Trace not in Xamarin.iOS???????????????????????? // http://forums.xamarin.com/discussion/comment/20763 // TODO: raise issue on forum!!! // // System.Diagnostics.Trace.Listeners.Clear(); // System.Diagnostics.Trace.Listeners.Add(categoryTraceListener); global::log4net.Repository.ILoggerRepository rep = global::log4net.LogManager.CreateRepository(Guid.NewGuid().ToString()); global::log4net.Appender.TraceAppender traceAppender = new global::log4net.Appender.TraceAppender(); traceAppender.Layout = new global::log4net.Layout.SimpleLayout(); traceAppender.ActivateOptions(); global::log4net.Config.BasicConfigurator.Configure(rep, traceAppender); global::log4net.ILog log = global::log4net.LogManager.GetLogger(rep.Name, new LogSamples().GetType()); log.Debug("Debug message HolisticWare DefaultCategoryTest()"); log.Info("Info message HolisticWare DefaultCategoryTest()"); log.Warn("Warning message HolisticWare DefaultCategoryTest()"); log.Error("Error message HolisticWare DefaultCategoryTest()"); log.Fatal("Fatal message HolisticWare DefaultCategoryTest()"); return; }
public static void Log04() { global::log4net.Appender.ConsoleAppender appender_console = null; global::log4net.Appender.DebugAppender appender_debug = null; global::log4net.Appender.TraceAppender appender_trace = null; //global::log4net.Appender.AndroidLogAppender appender_android = null; appender_console = new global::log4net.Appender.ConsoleAppender(); appender_debug = new global::log4net.Appender.DebugAppender(); //appender_trace = new global::log4net.Appender.TraceAppender(); //appender_android = new global::log4net.Appender.AndroidLogAppender(); global::log4net.Appender.AppenderSkeleton[] appenders = null; appenders = new global::log4net.Appender.AppenderSkeleton[] { appender_console , appender_debug //, appender_trace //, appender_android }; global::log4net.Repository.Hierarchy.Hierarchy hierarchy = null; hierarchy = (global::log4net.Repository.Hierarchy.Hierarchy) global::log4net.LogManager.GetRepository(); hierarchy.Root.AddAppender(appender_console); hierarchy.Root.AddAppender(appender_debug); //hierarchy.Root.AddAppender(appender_trace); //hierarchy.Root.AddAppender(appender_android); hierarchy.Configured = true; appender_console.ActivateOptions(); appender_debug.ActivateOptions(); //appender_trace.ActivateOptions(); //appender_android.ActivateOptions(); //global::log4net.Config.BasicConfigurator.Configure(appenders); global::log4net.ILog log = null; log = global::log4net.LogManager.GetLogger("HolisticWare Logger"); log.Debug("Debug message HolisticWare Log04()"); log.Info("Info message HolisticWare Log04()"); log.Warn("Warning message HolisticWare Log04()"); log.Error("Error message HolisticWare Log04()"); log.Fatal("Fatal message HolisticWare Log04()"); return; }