Esempio n. 1
0
        public static string GetStackEnvironmentInfo(AppInfo info, HeContext context)
        {
            AppInfoForStack     infoForStack    = FillAppInfoStruct(info, -1, -1);
            ContextInfoForStack contextForStack = FillContextInfoStruct(context);

            return(ErrorLogDefinition.GetStackEnvironmentInfo(infoForStack, contextForStack));
        }
 public static void Log(ErrorLogDefinition log)
 {
     try {
         if (LoggerInstance != null)
         {
             LoggerInstance.Log(log);
         }
         else
         {
             EventLogger.WriteError(log.Message);
         }
     } catch (Exception e) {
         EventLogger.WriteError("Error sending log: " + e.ToString());
     }
 }
Esempio n. 3
0
        public static string StaticWrite(DateTime instant, string sessionId, int espaceId, int tenantId, int userId, string message,
                                         string stack, string environmentInformation, string moduleName,
                                         string eSpaceName, string applicationName, ObjectKey applicationKey, string username)
        {
            string requestKey, actionName, entryPointName;

            requestKey = actionName = entryPointName = String.Empty;

            RequestTracer reqTracer = RuntimePlatformUtils.GetRequestTracer();

            if (reqTracer != null)
            {
                requestKey     = reqTracer.RequestKey;
                actionName     = reqTracer.EntryActionName;
                entryPointName = reqTracer.EntryEndpointName;
            }

            return(ErrorLogDefinition.StaticWrite(instant, sessionId, espaceId, tenantId, userId, message, stack, environmentInformation, moduleName, requestKey, entryPointName, actionName,
                                                  eSpaceName, applicationName, applicationKey, username));
        }
Esempio n. 4
0
        private static string LogApplicationError(DateTime instant, string message, Exception excep, AppInfo info, HeContext context, string moduleName,
                                                  string stackTrace, int overrideEspaceId, int overrideTenantId,
                                                  string overrideEspaceName = null, string overrideApplicationName = null, ObjectKey overrideApplicationKey = null)
        {
            visitsApplicationErrorLog = visitsApplicationErrorLog + 1;
            try {
                AppInfoForStack     infoForStack    = new AppInfoForStack();
                ContextInfoForStack contextForStack = new ContextInfoForStack();

                /* Prevent recursive loop attempt (#534214).
                 * 1st attempt tries to get info for logging (visitsApplicationErrorLog=1)
                 * 2nd attempt tries to log the new exception without getting info for logging (visitsApplicationErrorLog=2)
                 * 3rd attempt don't log the new exception to avoid recursive loops (visitsApplicationErrorLog>=3 */

                if (visitsApplicationErrorLog >= 3)
                {
                    return("");
                }

                /* Captain's Log #666 15:19 19/06/2017
                 * By now, we've concluded we can't properly refactor this without removing some information from our error logs.
                 * As of now, espace version id will no longer be logged on the second passing and we'll always try to fetch the
                 * context info(session id, user id and request tracer info) on the first and second passing, instead of only getting
                 * it at the first passing. To make this work, we must have sure that it never blows up. */
                if (visitsApplicationErrorLog < 2)
                {
                    infoForStack = FillAppInfoStruct(info, overrideEspaceId, overrideTenantId,
                                                     overrideEspaceName, overrideApplicationName, overrideApplicationKey);
                }

                contextForStack = FillContextInfoStruct(context);

                return(ErrorLogDefinition.LogApplicationError(instant, message, excep, moduleName, stackTrace, infoForStack, contextForStack));
            } finally {
                visitsApplicationErrorLog = visitsApplicationErrorLog - 1;
            }
        }
Esempio n. 5
0
 public override void Log(ErrorLogDefinition log)
 {
 }
 public abstract void Log(ErrorLogDefinition log);
 public override void Log(ErrorLogDefinition log)
 {
     Log(log, LogType.Error);
 }
Esempio n. 8
0
 public static string GenerateFullStack(Exception excep, out int countExceptions)
 {
     return(ErrorLogDefinition.GenerateFullStack(excep, out countExceptions));
 }