private static void CleanupTrace(TOM.Trace trace) { if (trace.IsStarted) { trace.Stop(); } if (trace.Parent != null) { trace.Drop(); } trace.Dispose(); }
public void Start() { if (!server.ConnectionInfo.Server.EqualsI("localhost")) { return; } try { if (trace != null) { if (!trace.IsStarted) { trace.Start(); } return; } this.trace = server.Traces.Add("TabularEditor-" + Guid.NewGuid().ToString("D")); sessionTraces.Add(this.trace); TOM.TraceEvent tEvent; tEvent = this.trace.Events.Add(AS.TraceEventClass.CommandEnd); tEvent.Columns.Add(AS.TraceColumn.EventSubclass); tEvent.Columns.Add(AS.TraceColumn.Success); tEvent.Columns.Add(AS.TraceColumn.TextData); tEvent.Columns.Add(AS.TraceColumn.ApplicationName); tEvent = this.trace.Events.Add(AS.TraceEventClass.ProgressReportCurrent); tEvent.Columns.Add(AS.TraceColumn.IntegerData); tEvent.Columns.Add(AS.TraceColumn.CurrentTime); tEvent.Columns.Add(AS.TraceColumn.ObjectName); tEvent.Columns.Add(AS.TraceColumn.ObjectPath); tEvent.Columns.Add(AS.TraceColumn.DatabaseName); this.trace.OnEvent += Trace_OnEvent; this.trace.Update(); this.trace.Start(); } catch { this.trace = null; } }
private void Configure() { if (server == null) { return; } if (!server.ConnectionInfo.Server.EqualsI("localhost")) { return; } try { currentTraceName = traceNamePrefix + Guid.NewGuid().ToString("D"); this.trace = server.Traces.Add(currentTraceName); tabularEditorSessionTraces.Add(this.trace); TOM.TraceEvent tEvent; tEvent = this.trace.Events.Add(AS.TraceEventClass.CommandEnd); tEvent.Columns.Add(AS.TraceColumn.EventSubclass); tEvent.Columns.Add(AS.TraceColumn.Success); tEvent.Columns.Add(AS.TraceColumn.TextData); tEvent.Columns.Add(AS.TraceColumn.ApplicationName); tEvent.Columns.Add(AS.TraceColumn.DatabaseName); tEvent = this.trace.Events.Add(AS.TraceEventClass.ProgressReportCurrent); tEvent.Columns.Add(AS.TraceColumn.IntegerData); tEvent.Columns.Add(AS.TraceColumn.CurrentTime); tEvent.Columns.Add(AS.TraceColumn.ObjectName); tEvent.Columns.Add(AS.TraceColumn.ObjectPath); tEvent.Columns.Add(AS.TraceColumn.DatabaseName); this.trace.OnEvent += Trace_OnEvent; this.trace.Update(); TabularModelHandler.Log("Analysis Services trace configured on localhost"); } catch (Exception ex) { this.trace = null; TabularModelHandler.Log("Exception while configuring Analysis Services trace", ex); } }