Exemplo n.º 1
0
 /// <summary>
 /// Remove an appender from our list
 /// </summary>
 /// <param name="appender">appender to remove</param>
 public static void RemoveAppender(Appender appender)
 {
     appenders.Remove(appender);
     if (appender == mainFileAppender)
     {
         mainFileAppender = null;
     }
     if (appender == mainConsoleAppender)
     {
         mainConsoleAppender = null;
     }
     if (appender == mainTraceAppender)
     {
         mainTraceAppender = null;
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Add an appender to our list
 /// </summary>
 /// <param name="newAppender">
 /// new appender to add
 /// </param>
 public static void AddAppender(Appender newAppender)
 {
     appenders.Add(newAppender);
     if (newAppender is FileAppender && mainFileAppender == null)
     {
         mainFileAppender = (FileAppender)newAppender;
     }
     if (newAppender is StandardOutputAppender && mainConsoleAppender == null)
     {
         mainConsoleAppender = (StandardOutputAppender)newAppender;
     }
     if (newAppender is TraceAppender && mainTraceAppender == null)
     {
         mainTraceAppender = (TraceAppender)newAppender;
     }
 }
Exemplo n.º 3
0
 public static void AddAppender(Appender newAppender)
 {
     appenders.Add(newAppender);
     if ((newAppender is FileAppender) && (mainFileAppender == null))
     {
         mainFileAppender = (FileAppender) newAppender;
     }
     if ((newAppender is StandardOutputAppender) && (mainConsoleAppender == null))
     {
         mainConsoleAppender = (StandardOutputAppender) newAppender;
     }
     if ((newAppender is TraceAppender) && (mainTraceAppender == null))
     {
         mainTraceAppender = (TraceAppender) newAppender;
     }
 }
Exemplo n.º 4
0
		static Logger()
		{
			Logger.format = "d MMM yyyy HH:mm:ss.fff";
			Logger.LEVEL_PARAM = "edtftp.log.level";
			Logger.loggers = Hashtable.Synchronized(new Hashtable(10));
			Logger.appenders = ArrayList.Synchronized(new ArrayList(2));
			Logger.showClassNames = true;
			Logger.showTimestamp = true;
			Logger.threadTags = new Dictionary<int, ILogTag>();
			Logger.mainFileAppender = null;
			Logger.mainConsoleAppender = null;
			Logger.mainTraceAppender = null;
			Logger.globalLevel = null;
			string text = null;
			try
			{
				text = ConfigurationSettings.AppSettings[Logger.LEVEL_PARAM];
			}
			catch (Exception ex)
			{
				Console.WriteLine("WARN: Failure reading configuration file: " + ex.Message);
			}
			if (text != null)
			{
				Logger.globalLevel = Level.GetLevel(text);
				if (Logger.globalLevel == null)
				{
					try
					{
						LogLevel level = (LogLevel)Enum.Parse(typeof(LogLevel), text, true);
						Logger.globalLevel = Level.GetLevel(level);
					}
					catch (Exception)
					{
					}
				}
			}
			if (Logger.globalLevel == null)
			{
				Logger.globalLevel = Level.OFF;
				if (text != null)
				{
					Console.Out.WriteLine(string.Concat(new string[]
					{
						"WARN: '",
						Logger.LEVEL_PARAM,
						"' configuration property invalid. Unable to parse '",
						text,
						"' - logging switched off"
					}));
				}
			}
		}
Exemplo n.º 5
0
		public static void RemoveAppender(Appender appender)
		{
			Logger.appenders.Remove(appender);
			if (appender == Logger.mainFileAppender)
			{
				Logger.mainFileAppender = null;
			}
			if (appender == Logger.mainConsoleAppender)
			{
				Logger.mainConsoleAppender = null;
			}
			if (appender == Logger.mainTraceAppender)
			{
				Logger.mainTraceAppender = null;
			}
		}
Exemplo n.º 6
0
		public static void AddAppender(Appender newAppender)
		{
			Logger.appenders.Add(newAppender);
			if (newAppender is FileAppender && Logger.mainFileAppender == null)
			{
				Logger.mainFileAppender = (FileAppender)newAppender;
			}
			if (newAppender is StandardOutputAppender && Logger.mainConsoleAppender == null)
			{
				Logger.mainConsoleAppender = (StandardOutputAppender)newAppender;
			}
			if (newAppender is TraceAppender && Logger.mainTraceAppender == null)
			{
				Logger.mainTraceAppender = (TraceAppender)newAppender;
			}
		}