Пример #1
0
        public static void Log(string message, TraceProvider.TraceSeverity severity, string category)
        {
            //string exeName = Assembly.GetExecutingAssembly().FullName;
            string exeName = "AIA.Intranet TraceProvider";

            TraceProvider.WriteTrace(0, severity, Guid.NewGuid(), exeName, "AIA.Intranet", category, message);
        }
Пример #2
0
        public static void LogMessage(ActivityExecutionContext executionContext, SPWorkflowHistoryEventType eventType, string outcome, string message, int userID, bool ccULS)
        {
            try
            {
                //write to Workflow History List
                ISharePointService spService = (ISharePointService)executionContext.GetService(typeof(ISharePointService));
                spService.LogToHistoryList(executionContext.ContextGuid, eventType, userID, TimeSpan.MinValue, outcome, message, message);

                //Write to ULS trace log
                if (ccULS)
                {
                    string source = executionContext.Activity.Name;
                    TraceProvider.TraceSeverity traceSeverity = TraceProvider.TraceSeverity.InformationEvent;

                    if (eventType == SPWorkflowHistoryEventType.WorkflowError)
                    {
                        traceSeverity = TraceProvider.TraceSeverity.Exception;
                    }

                    ULS.LogMessage(source, message, "Site Management", traceSeverity);
                }
            }
            catch (Exception ex)
            {
                EventLog.WriteEntry("SiteManagementActivity", "History Logging Failed:" + ex.ToString());
            }
        }
        public override void AddEntry(LogEntry entry)
        {
            string tagString = Properties.Settings.Default.Default_ProductName.Length >= 4 ? Properties.Settings.Default.Default_ProductName.Substring(0, 4) : "Alph";
            uint   tag       = TraceProvider.TagFromString(tagString);

            TraceProvider.TraceSeverity level = (TraceProvider.TraceSeverity)entry.Level;
            Guid   correlationGuid            = entry.Id;
            string exeName      = string.Empty;
            string productName  = entry.ProductName;
            string categoryName = string.Empty;
            string message      = entry.Message;

            TraceProvider.RegisterTraceProvider();
            TraceProvider.WriteTrace(tag, level, correlationGuid, exeName, productName, categoryName, message);
            TraceProvider.UnregisterTraceProvider();
        }
Пример #4
0
 public static void LogMessage(string source, string message, string category, TraceProvider.TraceSeverity severity)
 {
     // log error to ULS log
     TraceProvider.WriteTrace(0, severity, Guid.NewGuid(), Assembly.GetExecutingAssembly().FullName, source, category, message);
 }