public static void LOG(LOGGER.LogCategory logCategory, string message, Exception ex) { LOGGER._log = LogManager.GetLogger(Type.GetType("System.Object")); XmlConfigurator.Configure(); switch (logCategory) { case LOGGER.LogCategory.ERROR: LOGGER._log.Error(message, ex); return; case LOGGER.LogCategory.WARNING: LOGGER._log.Warn(message, ex); return; case LOGGER.LogCategory.INFORMATION: LOGGER._log.Info(message, ex); return; case LOGGER.LogCategory.DEBUG: LOGGER._log.Debug(message, ex); return; case LOGGER.LogCategory.FATAL: LOGGER._log.Fatal(message, ex); return; default: return; } }
private static SAFConfigurationParametersMap GetAllParametersFromDB() { SAFConfigurationParametersMap cacheData = new SAFConfigurationParametersMap(); try { string connStr = SAFConfiguration.readConnectionStringBusiness(); using (IDbConnection connection = new SqlConnection(connStr)) { connection.Open(); using (IDbCommand command = connection.CreateCommand()) { command.CommandType = CommandType.StoredProcedure; command.CommandText = "GetAllConfiguration"; IDataReader dr = command.ExecuteReader(CommandBehavior.CloseConnection); while (dr.Read()) { SAFConfigurationParameter par = new SAFConfigurationParameter(); par.section = dr.GetString(0); par.name = dr.GetString(1); par.value = dr.IsDBNull(2) ? null : dr.GetString(2); par.lastUTCupdate = dr.GetDateTime(3); par.frozen = dr.GetBoolean(4); par.hidden = dr.GetBoolean(5); string fullname = par.section + "@" + par.name; cacheData.Add(fullname, par); } } } //All went fine return(cacheData); } catch (Exception ex) { LOGGER.Write(LOGGER.LogCategory.ERROR, "SF.Expand.SAF.Configuration.SAFConfiguration::GetAllParameters failed. Err:" + ex.Message, ex); return(null); } }
private static string _readParameterBusiness(string parameterFullName, int cacheSecs) { SAFConfigurationParametersMap cacheData = _CheckCache(cacheSecs); if (cacheData == null) { return(null); } try { return((string)cacheData[parameterFullName].value); } catch (Exception ex) { LOGGER.Write(LOGGER.LogCategory.ERROR, "SF.Expand.SAF.Configuration.SAFConfiguration::readParameterBusinessChangeable error getting parameter[" + parameterFullName + "]. Err:" + ex.Message, ex); return(null); } }
public static void Write(LOGGER.LogCategory logcategory, string message, object logObject) { LOGGER.LOG(logcategory, message, (Exception)logObject); }
public static void Write(LOGGER.LogCategory logcategory, string message, object logObject) { LOGGER.LOG(logcategory, message, (Exception)logObject); }
public LogContextProperties(LOGGER.LogContextid logContextidid, string logContextValue) { this._logContextidid = logContextidid; this._logContextValue = logContextValue; }