Ejemplo n.º 1
0
        private static void BrowserNameVersionAction(Match match, dynamic obj)
        {
            ClientOsBrowser current = obj as ClientOsBrowser;

            current.BrowserName = new Regex(@"^[a-zA-Z]+", RegexOptions.IgnoreCase).Match(match.Value).Value;
            if (match.Value.Length > current.BrowserName.Length)
            {
                current.BrowserVersion = match.Value.Substring(current.BrowserName.Length + 1);
            }
        }
Ejemplo n.º 2
0
        void ILogixExceptionLogger.LogException(LogixLogError payLoad, dynamic httpContext)
        {
            Microsoft.AspNetCore.Http.HttpContext context = httpContext as Microsoft.AspNetCore.Http.HttpContext;

            LogixLogException logixLogException = new LogixLogException
            {
                UserErrorInfo = new LogixLogError
                {
                    ApplicationName = payLoad.ApplicationName,
                    ConnectLoginID  = payLoad.ConnectLoginID,
                    HelpLink        = payLoad.HelpLink,
                    HResult         = payLoad.HResult,
                    ErrorMessage    = payLoad.ErrorMessage,
                    Source          = payLoad.Source,
                    StackTrace      = payLoad.StackTrace
                },

                ApplicationPath       = context.Request.PathBase.Value,
                ApplicationPool       = null,
                ClientIPAddress       = context.Connection.RemoteIpAddress.ToString(),
                ClientMachine         = System.Net.Dns.GetHostEntry(context.Connection.RemoteIpAddress).HostName.ToString(),
                UserAgent             = context.Request.Headers["User-Agent"],
                LogonUserIdentityName = context.User.Identity.Name,
                RequestType           = context.Request.Method,
                RequestUrl            = context.Request.PathBase + "/" + context.Request.QueryString,

                AppMemEstimatedCPUTime     = null,
                AppMemEstimatedMemoryUsage = null,
                AppMemRequestsInAppQueue   = null,

                SvrMemAppPoolCPUUsage    = null,
                SvrMemAppPoolMemoryUsage = null,
                SvrMemAvailableMemory    = null,
                SvrMemCPUUsage           = null,

                SyncID           = System.Guid.NewGuid(),
                IsLoggedFromMsmq = false,               // Default value
                LogDateTime      = System.DateTime.Now, // Default value
            };

            try
            {
                ClientOsBrowser browser = new ClientOsBrowser(context.Request.Headers["User-Agent"]);
                if (browser != null)
                {
                    logixLogException.ClientOS      = browser.OSName + " " + browser.OSVersion;
                    logixLogException.ClientBrowser = browser.BrowserName + " " + browser.BrowserMajorVersion + " (" + browser.BrowserVersion + ")";
                }
            }
            catch (System.Exception)
            {
                // DO NOTHING
            }

            try
            {
                if (Configuration.UseMessageQueue.ToUpper() == "YES")
                {
                    logixLogException.IsLoggedFromMsmq = true;
                    _queueLogger.LogExceptions(logixLogException);
                }
                else
                {
                    _databaseLogger.LogExceptions(logixLogException);
                }
            }
            catch (System.ServiceModel.FaultException <LogixLogFaultException> faultException)
            {
                logixLogException = faultException.Detail.ErrorInfo;
            }
            catch (System.Exception generalException)
            {
                logixLogException.UserErrorInfo.StackTrace += ExtractExceptionDetail(generalException);
            }

            WriteExceptions(logixLogException);
        }