Example #1
0
 public void EnableLogging(LoggingInfo.LoggingSubsystem subsystem, LoggingInfo.LoggingType type)
 {
     try
     {
         this._renderer.SetLoggingStatus(subsystem, type, LoggingInfo.LogsStatus.Enable);
         AppUtil.LogEvent(RuntimeContext.CurrentContextName, subsystem.ToString() + " logging enabled successfully", EventLogEntryType.Information, EventCategories.Information, EventID.LoggingEnabled);
     }
     catch (Exception exc)
     {
         AppUtil.LogEvent(RuntimeContext.CurrentContextName, exc.ToString(), EventLogEntryType.Error, EventCategories.Error, EventID.GeneralError);
         throw;
     }
 }
Example #2
0
 public void DisableLogging(LoggingInfo.LoggingSubsystem subsystem, LoggingInfo.LoggingType type)
 {
     try
     {
         this._renderer.SetLoggingStatus(subsystem, type, LoggingInfo.LogsStatus.Disable);
         AppUtil.LogEvent("NCache", subsystem.ToString() + " logging disabled successfully", EventLogEntryType.Information, EventCategories.Information, EventID.LoggingDisabled);
     }
     catch (Exception exc)
     {
         AppUtil.LogEvent("NCache", exc.ToString(), EventLogEntryType.Error, EventCategories.Error, EventID.GeneralError);
         throw;
     }
 }
Example #3
0
 /// <summary>
 /// Get logging status for logging type
 /// </summary>
 /// <param name="type">Type of logging</param>
 /// <returns>Current status of logging</returns>
 public abstract LoggingInfo.LogsStatus GetLoggingStatus(LoggingInfo.LoggingSubsystem subsystem, LoggingInfo.LoggingType type);
Example #4
0
 /// <summary>
 /// Set and apply logging status for a logging type
 /// </summary>
 /// <param name="type">Type of logging</param>
 /// <param name="status">Logging status to set</param>
 public abstract void SetLoggingStatus(LoggingInfo.LoggingSubsystem subsystem, LoggingInfo.LoggingType type, LoggingInfo.LogsStatus status);
Example #5
0
        public void EnableLogging(LoggingInfo.LoggingSubsystem subsystem, LoggingInfo.LoggingType type)
        {
            ManagementCommand command = GetManagementCommand(ManagementUtil.MethodName.EnableLogging);
            command.Parameters.AddParameter(subsystem);
            command.Parameters.AddParameter(type);

            ExecuteCommandOnCacehServer(command);
        }
Example #6
0
        /// <summary>
        /// Set and apply logging status
        /// </summary>
        /// <param name="subsystem"></param>
        /// <param name="type"></param>
        /// <param name="status"></param>
        public override void SetLoggingStatus(LoggingInfo.LoggingSubsystem subsystem, LoggingInfo.LoggingType type, LoggingInfo.LogsStatus status)
        {
            if (subsystem == LoggingInfo.LoggingSubsystem.Client)
            {
                bool updateClient = false;
                switch (type)
                {
                    case LoggingInfo.LoggingType.Error:
                    case LoggingInfo.LoggingType.Detailed:
                        updateClient = ConnectionManager.SetClientLoggingInfo(type, status);
                        break;
                    case (LoggingInfo.LoggingType.Error | LoggingInfo.LoggingType.Detailed):
                        bool updateErrorLogs = ConnectionManager.SetClientLoggingInfo(LoggingInfo.LoggingType.Error, status);
                        bool updateDetailedLogs = ConnectionManager.SetClientLoggingInfo(LoggingInfo.LoggingType.Detailed, status);
                        updateClient = (updateErrorLogs || updateDetailedLogs);
                        break;
                }

                if (updateClient)
                    ConnectionManager.UpdateClients();
            }
            else if (subsystem == LoggingInfo.LoggingSubsystem.Server)
            {
                switch (status)
                {
                    case LoggingInfo.LogsStatus.Disable:

                        ///If error logs are disabled, then disable both
                        if (type == LoggingInfo.LoggingType.Error ||
                            type == (LoggingInfo.LoggingType.Error | LoggingInfo.LoggingType.Detailed))
                        {
                            this.InitializeLogging(false, false);
                        }
                        else if (type == LoggingInfo.LoggingType.Detailed)
                        {
                            this.InitializeLogging(Logger.IsErrorLogsEnabled, false);
                        }

                        break;

                    case LoggingInfo.LogsStatus.Enable:

                        bool error = Logger.IsErrorLogsEnabled;
                        bool detailed = Logger.IsDetailedLogsEnabled;

                        if (type == LoggingInfo.LoggingType.Error)
                        {
                            error = true;
                            detailed = false;
                        }
                        else if (type == LoggingInfo.LoggingType.Detailed |
                            type == (LoggingInfo.LoggingType.Error | LoggingInfo.LoggingType.Detailed))
                        {
                            error = true;
                            detailed = true;
                        }

                        this.InitializeLogging(error, detailed);

                        break;
                }
            }
        }
Example #7
0
 /// <summary>
 /// Get current logging status for specified type
 /// </summary>
 /// <param name="subsystem"></param>
 /// <param name="type"></param>
 /// <returns></returns>
 public override LoggingInfo.LogsStatus GetLoggingStatus(LoggingInfo.LoggingSubsystem subsystem, LoggingInfo.LoggingType type)
 {
     switch (subsystem)
     {
         case LoggingInfo.LoggingSubsystem.Server:
             lock (_serverLoggingInfo)
             {
                 return _serverLoggingInfo.GetStatus(type);
             }
         case LoggingInfo.LoggingSubsystem.Client:
             return ConnectionManager.GetClientLoggingInfo(type);
         default:
             return LoggingInfo.LogsStatus.Disable;
     }
 }
Example #8
0
 /// <summary>
 /// Set client logging info
 /// </summary>
 /// <param name="type"></param>
 /// <param name="status"></param>
 public static bool SetClientLoggingInfo(LoggingInfo.LoggingType type, LoggingInfo.LogsStatus status)
 {
     lock (_clientLogginInfo)
     {
         if (_clientLogginInfo.GetStatus(type) != status)
         {
             _clientLogginInfo.SetStatus(type, status);
             return true;
         }
         return false;
     }
 }
Example #9
0
 /// <summary>
 /// Get client logging information
 /// </summary>
 public static LoggingInfo.LogsStatus GetClientLoggingInfo(LoggingInfo.LoggingType type)
 {
     lock (_clientLogginInfo)
     {
         return _clientLogginInfo.GetStatus(type);
     }
 }