Beispiel #1
0
        public void Prepare(ILogEvent logEvent)
        {
            var identity = Thread.CurrentPrincipal.Identity;

            logEvent.Set(KEY_IDENTITY_NAME, identity.Name);
            logEvent.Set(KEY_IDENTITY_AUTHENTICATED, identity.IsAuthenticated);
            logEvent.Set(KEY_IDENTITY_TYPE, identity.AuthenticationType);
        }
Beispiel #2
0
        public void Prepare(ILogEvent logEvent)
        {
            var context = HttpContext.Current;

            if (context == null || IsRequestResponseHidden(context))
            {
                return;
            }

            var request = context.Request;

            if (request == null)
            {
                return;
            }

            Func <NameValueCollection> formGetter;
            Func <NameValueCollection> queryStringGetter;

            ValidationUtility.GetUnvalidatedCollections(HttpContext.Current, out formGetter, out queryStringGetter);

            var form = formGetter();

            logEvent.Set(KEY_REQUEST_ID, request.GetRequestId());
            logEvent.Set(KEY_REQUEST_IP, request.GetClientAddress());
            logEvent.Set(KEY_REQUEST_METHOD, request.HttpMethod);
            logEvent.Set(KEY_REQUEST_URL, request.Url);
            logEvent.Set(KEY_REQUEST_REFERRER, request.UrlReferrer);
            logEvent.Set(KEY_REQUEST_AGENT, request.UserAgent);

            logEvent.Set(KEY_REQUEST_COOKIES, string.Join("; ", request.Cookies.AllKeys.Select(k => string.Format("{0} = '{1}'", k, request.Cookies[k].Value))));
            logEvent.Set(KEY_REQUEST_POST, string.Join("; ", form.AllKeys.Select(k => string.Format("{0} = '{1}'", k, CensorePasswords && k.ToUpperInvariant().Contains("PASSWORD") ? "*******" : form[k]))));
        }
        public void Prepare(ILogEvent logEvent)
        {
            var context = HttpContext.Current;
            if (context == null || IsRequestResponseHidden(context))
                return;

            var request = context.Request;
            if (request == null)
                return;

            Func<NameValueCollection> formGetter;
            Func<NameValueCollection> queryStringGetter;

            ValidationUtility.GetUnvalidatedCollections(HttpContext.Current, out formGetter, out queryStringGetter);

            var form = formGetter();

            logEvent.Set(KEY_REQUEST_ID, request.GetRequestId());
            logEvent.Set(KEY_REQUEST_IP, request.GetClientAddress());
            logEvent.Set(KEY_REQUEST_METHOD, request.HttpMethod);
            logEvent.Set(KEY_REQUEST_URL, request.Url);
            logEvent.Set(KEY_REQUEST_REFERRER, request.UrlReferrer);
            logEvent.Set(KEY_REQUEST_AGENT, request.UserAgent);

            logEvent.Set(KEY_REQUEST_COOKIES, string.Join("; ", request.Cookies.AllKeys.Select(k => string.Format("{0} = '{1}'", k, request.Cookies[k].Value))));
            logEvent.Set(KEY_REQUEST_POST, string.Join("; ", form.AllKeys.Select(k => string.Format("{0} = '{1}'", k, CensorePasswords && k.ToUpperInvariant().Contains("PASSWORD") ? "*******" : form[k]))));
        }
Beispiel #4
0
        private void PrepareEvent(ILogEvent logEvent)
        {
            if (logEvent.IsSet(EVENT_PREPARED))
            {
                return;
            }

            foreach (var interceptor in LogEventInterceptorProviders.Providers.GetInterceptors())
            {
                interceptor.Prepare(logEvent);
            }

            logEvent.Set(EVENT_PREPARED, true);
        }
Beispiel #5
0
 public void Prepare(ILogEvent logEvent)
 {
     logEvent.Set(KEY_RUN_ID, RunId);
 }
 public void Prepare(ILogEvent logEvent)
 {
     logEvent.Set(KEY_RUN_ID, RunId);
 }
 public void Prepare(ILogEvent logEvent)
 {
     logEvent.Set(KEY_MESSAGE_ID, Guid.NewGuid());
 }
 public void Prepare(ILogEvent logEvent)
 {
     logEvent.Set(KEY_MESSAGE_ID, Guid.NewGuid());
 }
Beispiel #9
0
        private void PrepareEvent(ILogEvent logEvent)
        {
            if (logEvent.IsSet(EVENT_PREPARED))
                return;

            foreach (var interceptor in LogEventInterceptorProviders.Providers.GetInterceptors())
                interceptor.Prepare(logEvent);

            logEvent.Set(EVENT_PREPARED, true);
        }