internal virtual bool Init(FairSchedulerConfiguration conf)
 {
     if (conf.IsEventLogEnabled())
     {
         try
         {
             logDir = conf.GetEventlogDir();
             FilePath logDirFile = new FilePath(logDir);
             if (!logDirFile.Exists())
             {
                 if (!logDirFile.Mkdirs())
                 {
                     throw new IOException("Mkdirs failed to create " + logDirFile.ToString());
                 }
             }
             string username = Runtime.GetProperty("user.name");
             logFile = string.Format("%s%shadoop-%s-fairscheduler.log", logDir, FilePath.separator
                                     , username);
             logDisabled = false;
             PatternLayout layout = new PatternLayout("%d{ISO8601}\t%m%n");
             appender = new DailyRollingFileAppender(layout, logFile, "'.'yyyy-MM-dd");
             appender.ActivateOptions();
             Log.Info("Initialized fair scheduler event log, logging to " + logFile);
         }
         catch (IOException e)
         {
             Log.Error("Failed to initialize fair scheduler event log. Disabling it.", e);
             logDisabled = true;
         }
     }
     else
     {
         logDisabled = true;
     }
     return(!(logDisabled));
 }
示例#2
0
            public override void Log(int level, string message)
            {
                switch (level)
                {
                case Logger.Debug:
                {
                    Log.Debug(message);
                    break;
                }

                case Logger.Info:
                {
                    Log.Info(message);
                    break;
                }

                case Logger.Warn:
                {
                    Log.Warn(message);
                    break;
                }

                case Logger.Error:
                {
                    Log.Error(message);
                    break;
                }

                case Logger.Fatal:
                {
                    Log.Fatal(message);
                    break;
                }

                default:
                {
                    break;
                }
                }
            }