public StringBuilder Execute(Dictionary<string, StringBuilder> values, IWorkspace theWorkspace)
 {
     try
     {
         var logLevel = Dev2Logger.GetLogLevel();
         var logMaxSize= Dev2Logger.GetLogMaxSize();
         var loggingSettings = new LoggingSettingsTo {LogLevel = logLevel,LogSize = logMaxSize};
         var serializer = new Dev2JsonSerializer();
         var serializeToBuilder = serializer.SerializeToBuilder(loggingSettings);
         return serializeToBuilder;
     }
     catch (Exception e)
     {
         Dev2Logger.Log.Error("LoggingSettingsRead", e);
     }
     return null;
 }
示例#2
0
        public LogSettingsViewModel(LoggingSettingsTo logging, IEnvironmentModel currentEnvironment)
        {
            if (logging == null) throw new ArgumentNullException("logging");
            if (currentEnvironment == null) throw new ArgumentNullException("currentEnvironment");
            CurrentEnvironment = currentEnvironment;
            GetServerLogFileCommand = new DelegateCommand(OpenServerLogFile);
            GetStudioLogFileCommand = new DelegateCommand(OpenStudioLogFile);
            LogLevel serverLogLevel;
            if (Enum.TryParse(logging.LogLevel,out serverLogLevel))
            {
                _serverLogLevel = serverLogLevel;
            }
            _serverLogMaxSize = logging.LogSize.ToString(CultureInfo.InvariantCulture);

            LogLevel studioLogLevel;
            if (Enum.TryParse(Dev2Logger.GetLogLevel(), out studioLogLevel))
            {
                _studioLogLevel = studioLogLevel;
            }
            _studioLogMaxSize = Dev2Logger.GetLogMaxSize().ToString(CultureInfo.InvariantCulture);
        }
 static LogSettingsViewModel CreateLogSettingViewModel()
 {
     XmlConfigurator.ConfigureAndWatch(new FileInfo("Settings.config"));
     var loggingSettingsTo = new LoggingSettingsTo { LogSize = 50, LogLevel = "TRACE" };
     var logSettingsViewModel = new LogSettingsViewModel(loggingSettingsTo, new Mock<IEnvironmentModel>().Object);
     return logSettingsViewModel;
 }
示例#4
0
 public virtual void Save(LoggingSettingsTo logSettings)
 {
     logSettings.LogLevel = ServerLogLevel.ToString();
     logSettings.LogSize = int.Parse(ServerLogMaxSize);
     var settingsConfigFile = HelperUtils.GetStudioLogSettingsConfigFile();
     Dev2Logger.WriteLogSettings(StudioLogMaxSize, StudioLogLevel.ToString(), settingsConfigFile);
 }
 public static void Write(LoggingSettingsTo loggingSettingsTo)
 {
     VerifyArgument.IsNotNull("loggingSettingsTo", loggingSettingsTo);
     Dev2Logger.WriteLogSettings(loggingSettingsTo.LogSize.ToString(CultureInfo.InvariantCulture), loggingSettingsTo.LogLevel, "Settings.config");
 }