private static void GlobalActivityLogger(object sender, ActivityEventArgs args)
        {
            IActivityScope activityScope = sender as IActivityScope;

            if (activityScope.ActivityType == ActivityType.Global && (args.ActivityEventType == ActivityEventType.EndActivity || args.ActivityEventType == ActivityEventType.SuspendActivity))
            {
                RequestDetailsLoggerBase <T> requestDetailsLoggerBase = RequestDetailsLoggerBase <T> .InitializeRequestLogger(activityScope);

                ServiceCommonMetadataPublisher.PublishServerInfo(requestDetailsLoggerBase.ActivityScope);
                requestDetailsLoggerBase.Commit();
            }
        }
        private static void PublishGeneric(HttpContextBase context)
        {
            IActivityScope currentActivityScope = ServiceCommonMetadataPublisher.GetCurrentActivityScope(context);

            if (currentActivityScope == null)
            {
                return;
            }
            ServiceCommonMetadataPublisher.PublishServerInfo(currentActivityScope);
            if (context == null)
            {
                return;
            }
            HttpRequestBase  request  = context.Request;
            HttpResponseBase response = context.Response;
            string           value    = request.GetRequestHeader("X-Forwarded-For");

            if (string.IsNullOrEmpty(value))
            {
                value = request.UserHostAddress;
            }
            currentActivityScope.SetProperty(ServiceCommonMetadata.ClientIpAddress, value);
            currentActivityScope.SetProperty(ActivityStandardMetadata.ClientInfo, request.UserAgent);
            currentActivityScope.SetProperty(ServiceCommonMetadata.RequestSize, request.ContentLength.ToString());
            if (currentActivityScope.GetProperty(ServiceCommonMetadata.HttpStatus) == null)
            {
                currentActivityScope.SetProperty(ServiceCommonMetadata.HttpStatus, response.StatusCode.ToString());
            }
            if (request.Cookies.Count > 0)
            {
                for (int i = 0; i < request.Cookies.Count; i++)
                {
                    if (string.Equals(request.Cookies[i].Name, "exchangecookie", StringComparison.OrdinalIgnoreCase))
                    {
                        currentActivityScope.SetProperty(ServiceCommonMetadata.Cookie, request.Cookies[i].Value);
                        return;
                    }
                }
            }
        }