示例#1
0
 private static void AppendInternal(string operation, string parameter, string ipAddress, string resultCode, GlsRawResponse rawResponse, long processingTime, string failure, string transactionid, string connectionid, string diagnostics, Guid activityId)
 {
     if (rawResponse == null)
     {
         rawResponse = new GlsRawResponse();
     }
     if (!GLSLogger.Initialized)
     {
         lock (GLSLogger.logLock)
         {
             if (!GLSLogger.Initialized)
             {
                 GLSLogger.Initialize(ExDateTime.UtcNow, Path.Combine(GLSLogger.GetExchangeInstallPath(), "Logging\\GLS\\"), GLSLogger.defaultMaxRetentionPeriod, GLSLogger.defaultDirectorySizeQuota, GLSLogger.defaultPerFileSizeQuota, true);
             }
         }
     }
     if (GLSLogger.Enabled)
     {
         LogRowFormatter logRowFormatter = new LogRowFormatter(GLSLogger.schema);
         logRowFormatter[1]  = GLSLogger.GetNextSequenceNumber();
         logRowFormatter[2]  = Globals.ProcessName;
         logRowFormatter[3]  = Globals.ProcessId;
         logRowFormatter[4]  = Globals.ProcessAppName;
         logRowFormatter[5]  = Environment.CurrentManagedThreadId;
         logRowFormatter[6]  = operation;
         logRowFormatter[7]  = parameter;
         logRowFormatter[9]  = processingTime;
         logRowFormatter[8]  = resultCode;
         logRowFormatter[10] = ipAddress;
         logRowFormatter[11] = rawResponse.ResourceForest;
         logRowFormatter[12] = rawResponse.AccountForest;
         logRowFormatter[13] = rawResponse.TenantContainerCN;
         logRowFormatter[14] = rawResponse.TenantId;
         logRowFormatter[15] = rawResponse.SmtpNextHopDomain;
         logRowFormatter[16] = rawResponse.TenantFlags;
         logRowFormatter[17] = rawResponse.DomainName;
         logRowFormatter[18] = rawResponse.DomainInUse;
         logRowFormatter[19] = rawResponse.DomainFlags;
         logRowFormatter[20] = failure;
         logRowFormatter[21] = transactionid;
         logRowFormatter[22] = connectionid;
         logRowFormatter[23] = diagnostics;
         logRowFormatter[24] = activityId;
         GLSLogger.log.Append(logRowFormatter, 0);
     }
 }
示例#2
0
        public static void LogResponse(GlsLoggerContext context, GLSLogger.StatusCode statusCode, ResponseBase response, GlsRawResponse rawResponse)
        {
            int    num = Environment.TickCount - context.TickStart;
            string resultCode;

            switch (statusCode)
            {
            case GLSLogger.StatusCode.Found:
                resultCode = "Found";
                break;

            case GLSLogger.StatusCode.NotFound:
                resultCode = "NotFound";
                break;

            case GLSLogger.StatusCode.WriteSuccess:
                resultCode = "Success";
                break;

            default:
                throw new ArgumentException("statusCode");
            }
            GLSLogger.BeginAppend(context.MethodName, context.ParameterValue, context.ResolveEndpointToIpAddress(false), resultCode, rawResponse, (long)num, string.Empty, response.TransactionID, context.ConnectionId, response.Diagnostics);
            ADProviderPerf.UpdateGlsCallLatency(context.MethodName, context.IsRead, num, true);
        }
示例#3
0
        internal static void BeginAppend(string operation, string parameter, string ipAddress, string resultCode, GlsRawResponse rawResponse, long processingTime, string failure, string transactionId, string connectionId, string diagnostics)
        {
            GLSLogger.AppendDelegate appendDelegate = new GLSLogger.AppendDelegate(GLSLogger.AppendInternal);
            Guid activityId = Guid.Empty;

            try
            {
                IActivityScope currentActivityScope = ActivityContext.GetCurrentActivityScope();
                if (currentActivityScope != null && currentActivityScope.Status == ActivityContextStatus.ActivityStarted)
                {
                    activityId = currentActivityScope.ActivityId;
                }
            }
            catch (Exception ex)
            {
                diagnostics += ex.ToString();
            }
            appendDelegate.BeginInvoke(operation, parameter, ipAddress, resultCode, rawResponse, processingTime, failure, transactionId, connectionId, diagnostics, activityId, null, null);
        }