Beispiel #1
0
        /// <summary>
        ///  Setup the log4net and define appenders.
        /// </summary>
        private void SetupLogger()
        {
            Hierarchy hierarchy = (Hierarchy)LogManager.GetRepository();

            hierarchy.Root.Level = Level.Debug;
            hierarchy.RaiseConfigurationChanged(EventArgs.Empty);

            AppenderSkeleton consoleAppender, fileAppender;

            if (MonoUtil.IsRunningOnMono())
            {
                consoleAppender = new ConsoleAppender();
            }
            else
            {
                consoleAppender = new ColoredConsoleAppender();
            }

            consoleAppender.Layout    = new PatternLayout(@"[%date][%c][%level] %message %newline");
            consoleAppender.Threshold = Level.Debug;
            consoleAppender.ActivateOptions();

            // fileAppender = new FileAppender();
            // fileAppender.AppendToFile = true;
            // fileAppender.Layout = new PatternLayout(@"[%date][%c][%level] %message %newline");
            // fileAppender.Threshold = Level.Debug;
            // fileAppender.File = "log.txt";
            // fileAppender.ActivateOptions();

            BasicConfigurator.Configure(consoleAppender);
            // BasicConfigurator.Configure(FileAppender);
        }
Beispiel #2
0
 private static IPersistenceConfigurer GetSQLite()
 {
     if (MonoUtil.IsRunningOnMono())
     {
         return(MonoSQLiteConfiguration.Standard
                .UsingFile(DatabaseSettings.Instance.Name + ".sqlite").ShowSql());
     }
     else
     {
         return(SQLiteConfiguration.Standard.UsingFile(DatabaseSettings.Instance.Name + ".sqlite").ShowSql());
     }
 }