The Raven Client, responsible for capturing exceptions and sending them to Sentry.
Inheritance: IRavenClient
        protected override void Append(LoggingEvent loggingEvent)
        {
            if (ravenClient == null)
            {
                ravenClient = new RavenClient(DSN);
                ravenClient.Logger = Logger;
            }

            if (loggingEvent.ExceptionObject != null)
            {
                ravenClient.CaptureEvent(loggingEvent.ExceptionObject);
            }
            else
            {
                // TODO: Handle log4net messages without an exception.
                var data = loggingEvent.MessageObject as IList<string>;

                if (data != null)
                {
                    foreach (string s in data)
                    {
                        // Do something with each string
                    }
                }
            }
        }
Ejemplo n.º 2
0
        internal static void Initialise()
        {
            ravenClient = new RavenClient(Global.RAVEN_DSN);
            ravenClient.Release = Global.VERSION;
            ravenClient.Logger = "client";

            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.ThrowException);
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
        }
        private static StructureMap.Container DefaultContainer()
        {
            var dns = ConfigurationManager.AppSettings["revenDns"];           

            IRavenClient revenClient = new RavenClient(new Dsn(dns));
            return new StructureMap.Container(x =>
            {
                x.For<IDNSService>().Add<DNSService>();
                x.For<I_IISService>().Add<IISService>();
                x.For<IRavenClient>().Add(revenClient);
            });
        }
Ejemplo n.º 4
0
    static void setup()
    {
        Debug.Log("Initializing RavenClient.");
        ravenClient             = new RavenClient(dsnUrl);
        ravenClient.Logger      = "C#";
        ravenClient.LogScrubber = new SharpRaven.Logging.LogScrubber();

        Debug.Log("Sentry Uri: " + ravenClient.CurrentDSN.SentryURI);
        Debug.Log("Port: " + ravenClient.CurrentDSN.Port);
        Debug.Log("Public Key: " + ravenClient.CurrentDSN.PublicKey);
        Debug.Log("Private Key: " + ravenClient.CurrentDSN.PrivateKey);
        Debug.Log("Project ID: " + ravenClient.CurrentDSN.ProjectID);
    }
Ejemplo n.º 5
0
    static void setup()
    {
        Debug.Log("Initializing RavenClient.");
        ravenClient = new RavenClient(dsnUrl);
        ravenClient.Logger = "C#";
        ravenClient.LogScrubber = new SharpRaven.Logging.LogScrubber();

        Debug.Log("Sentry Uri: " + ravenClient.CurrentDSN.SentryURI);
        Debug.Log("Port: " + ravenClient.CurrentDSN.Port);
        Debug.Log("Public Key: " + ravenClient.CurrentDSN.PublicKey);
        Debug.Log("Private Key: " + ravenClient.CurrentDSN.PrivateKey);
        Debug.Log("Project ID: " + ravenClient.CurrentDSN.ProjectID);
    }
Ejemplo n.º 6
0
 /// <summary>
 /// Handles the Click event of the btnSubmitError control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 /// <exception cref="Exception"></exception>
 protected void btnSubmitError_Click( object sender, EventArgs e )
 {
     try
     {
         throw new Exception( tbError.Text );
     }
     catch ( Exception ex )
     {
         var sentryDSN = GlobalAttributesCache.Read().GetValue( "SentryDSN" ) ?? string.Empty;
         var sentryClient = new RavenClient( sentryDSN );
         if ( !string.IsNullOrEmpty( sentryDSN ) && sentryClient != null )
         {
             sentryClient.Capture( new SentryEvent( ex ) );
             nbInformation.Visible = true;
         }
     }
 }
        public void LogException( Exception ex )
        {
            var personAlias = this.GetPersonAlias();
            Model.ExceptionLogService.LogException( ex, HttpContext.Current, null, null, personAlias );

            // send the event to Sentry if configured
            var sentryDSN = Web.Cache.GlobalAttributesCache.Read().GetValue( "SentryDSN" ) ?? string.Empty;
            var sentryClient = new RavenClient( sentryDSN );
            if ( !string.IsNullOrEmpty( sentryDSN ) && sentryClient != null )
            {
                //var exceptionLog = new ExceptionLog
                //{
                //    HasInnerException = ex.InnerException != null,
                //    ExceptionType = ex.GetType().ToString(),
                //    Description = ex.Message,
                //    Source = ex.Source,
                //    StackTrace = ex.StackTrace,
                //    CreatedByPersonAliasId = personAlias.Id,
                //    ModifiedByPersonAliasId = personAlias.Id,
                //    CreatedDateTime = RockDateTime.Now,
                //    ModifiedDateTime = RockDateTime.Now,
                //};

                //var context = HttpContext.Current;
                //if ( context != null && context.Request != null && context.Response != null )
                //{
                //    exceptionLog.StatusCode = context.Response.StatusCode.ToString();
                //    exceptionLog.PageUrl = context.Request.Url.ToString();
                //    exceptionLog.QueryString = context.Request.Url.Query;

                //    var formItems = context.Request.Form;
                //    if ( formItems.Keys.Count > 0 )
                //    {
                //        exceptionLog.Form = formItems.AllKeys.ToDictionary( k => k, k => formItems[k] ).ToString();
                //    }

                //    var serverVars = context.Request.ServerVariables;
                //    if ( serverVars.Keys.Count > 0 )
                //    {
                //        exceptionLog.ServerVariables = serverVars.AllKeys.ToDictionary( k => k, k => serverVars[k] ).ToString();
                //    }
                //}

                //ex.Data.Add( "context", exceptionLog );
                sentryClient.Capture( new SentryEvent( ex ) );
            }
        }