override protected void Append(LoggingEvent loggingEvent)
        {
            var hub = GlobalHost.ConnectionManager.GetHubContext<SignalrAppenderHub>();
            
            // LoggingEvent may be used beyond the lifetime of the Append()
            // so we must fix any volatile data in the event
            loggingEvent.Fix = Fix;

            var formattedEvent = RenderLoggingEvent(loggingEvent);

            if (hub != null)
            {
                var e = new LogEntry(formattedEvent, loggingEvent);
                var logEventObject = new
                {
                    e.FormattedEvent,
                    Message = e.LoggingEvent.ExceptionObject != null ? e.LoggingEvent.ExceptionObject.Message : e.LoggingEvent.RenderedMessage,
                    Level = e.LoggingEvent.Level.Name,
                    TimeStamp = e.LoggingEvent.TimeStamp.ToString("yyyy-MM-dd HH:mm:ss.fff")
                    /* e.LoggingEvent.Domain,
                    e.LoggingEvent.Identity,
                    e.LoggingEvent.LocationInformation,
                    e.LoggingEvent.LoggerName,
                    e.LoggingEvent.MessageObject,
                    e.LoggingEvent.Properties,
                    e.LoggingEvent.ThreadName,
                    e.LoggingEvent.UserName */
                };

                hub.Clients.All.onLoggedEvent(logEventObject);
            }
        }
 private void ProxyOnMessageLogged(LogEntry entry)
 {
     try
     {
         proxyConnection.Invoke("OnMessageLogged", entry);
     }
     catch (Exception e){
         LogManager.GetLogger("").Warn("OnMessageLogged Failed:", e);
     }
 }
Ejemplo n.º 3
0
 private void SendLogEntryOverGlobalHost(LogEntry entry)
 {
     try
     {
         var hubContext = Microsoft.AspNet.SignalR.GlobalHost.ConnectionManager.GetHubContext(this.HubName);
         hubContext.Clients.Group(this.GroupName).onLoggedEvent(entry.FormattedEvent, entry.LoggingEvent);
     }
     catch (Exception e)
     {
         LogManager.GetLogger(string.Empty).Warn("SendLogEntryOverGlobalHost Failed:", e);
     }
 }
        override protected void Append(LoggingEvent loggingEvent)
        {
            // LoggingEvent may be used beyond the lifetime of the Append()
            // so we must fix any volatile data in the event
            loggingEvent.Fix = Fix;

            var formattedEvent = RenderLoggingEvent(loggingEvent);

            var logEntry = new LogEntry(formattedEvent, new JsonLoggingEventData(loggingEvent));

            if (proxyConnection != null)
            {
                ProxyOnMessageLogged(logEntry);
            } else if (MessageLogged != null)
            {
                MessageLogged(logEntry);
            }
        }
Ejemplo n.º 5
0
        protected override void Append(LoggingEvent loggingEvent)
        {
            // LoggingEvent may be used beyond the lifetime of the Append()
            // so we must fix any volatile data in the event
            loggingEvent.Fix = FixFlags.All;

            var formattedEvent = RenderLoggingEvent(loggingEvent);

            var logEntry = new LogEntry(formattedEvent, new JsonLoggingEventData(loggingEvent));

            if (string.IsNullOrEmpty(this.ProxyUrl))
            {
                this.SendLogEntryOverGlobalHost(logEntry);
            }
            else
            {
                this.SendLogEntryOverProxy(logEntry);
            }
        }
Ejemplo n.º 6
0
 public virtual void OnMessageLogged(LogEntry e, string groupName)
 {
     this.Clients.Group(groupName).onLoggedEvent(e.FormattedEvent, e.LoggingEvent);
 }
Ejemplo n.º 7
0
 public void OnMessageLogged(LogEntry e)
 {
     this.OnMessageLogged(e, DefaultGroup);
 }
 public void OnMessageLogged(LogEntry e)
 {
     Clients.Group(Log4NetGroup).onLoggedEvent(e.FormattedEvent, e.LoggingEvent);
 }
Ejemplo n.º 9
0
 private void SendLogEntryOverProxy(LogEntry entry)
 {
     try
     {
         this.EnsureConnection();
         if (proxyConnection != null && this.hubConnection.State == ConnectionState.Connected)
         {
             this.proxyConnection.Invoke("OnMessageLogged", entry, this.GroupName);
         }
     }
     catch (Exception e)
     {
         LogManager.GetLogger(string.Empty).Warn("OnMessageLogged Failed:", e);
     }
 }
Ejemplo n.º 10
0
 private void OnMessageLogged(LogEntry e)
 {
     Clients[Log4NetGroup].onLoggedEvent(e.FormattedEvent, e.LoggingEvent);
 }