Questions tagged [traceswitch]

9 questions
10
votes
3 answers

TraceSwitch and SourceSwitch - what's the difference?

So I'm probably missing the obvious here, but what actually is the difference between the functionality of the TraceSwitch and SourceSwitch classes? They both give identical summary descriptions: Provides a multilevel switch to control tracing and…
Noldorin
  • 144,213
  • 56
  • 264
  • 302
3
votes
1 answer

Where should I put a project- or application-wide TraceSwitch in my design?

I'm trying to enhance my program with some logging functionality provided by System.Diagnostics. As my Solution consists of several projects, I wanted to create a switch for the whole application and one for every project. Now the question is, how…
Michael Klement
  • 3,376
  • 3
  • 30
  • 34
3
votes
4 answers

Should a TraceSource be guarded with "if" statements?

Before tracing to a TraceSource, should the "Trace Level" be checked prior to issuing the trace itself? var ts = new TraceSource("foo"); ts.Switch.Level = SourceLevels.Warning; if (/* should there be a guard here? and if so, what? */) { …
user2864740
  • 60,010
  • 15
  • 145
  • 220
2
votes
2 answers

How to filter trace listened by event id?

I'm using next method to add a trace record: TraceSource.TraceEvent(TraceEventType, Int32, String) where Int32 represents event id. So how to filter in TraceSwitch to listen only by specified event id? Ir this is impossible?
abatishchev
  • 98,240
  • 88
  • 296
  • 433
1
vote
1 answer

Why Won't My DLL.config File Load on Some Machines

I have an Outlook Add-in written in C#, MyAddin.dll, that has a configuration file MyAddin.dll.config. Both are stored in the same directory. They are placed there and installed by an installer. On most installations, there is no problem with…
Les
  • 10,335
  • 4
  • 40
  • 60
1
vote
1 answer

Toggling TraceSwitch at runtime

I'm trying to get access to some diagnostic information available in the .NET System.Net tracing functionality in my application. I am aware that I can set the tracing level using the appropriate .config, but I was hoping to be able to toggle the…
StarBright
  • 251
  • 1
  • 2
  • 5
0
votes
0 answers

How can I fix this error? TypeError: compute_minimal_traces() missing 1 required positional argument: 'event_log'

This is the code: I need help on solving those errors. I tried to create an instance. I get the following errors. The main goal is to find an pattern from that event_log. Please let me know what other details I need to fix on this. import pandas as…
0
votes
1 answer

TraceSwitch - How to turn trace on/off in config file based on user data

I wanted to turn on trace for some user data, for example a specific flight number, or a specific trading partner. Would I create a custom switch class, then read some appSetting variables to determine which user data turns the trace on and off?…
NealWalters
  • 17,197
  • 42
  • 141
  • 251
0
votes
1 answer

How to get acces into switch declared in App.config?

This is a snippet from my App.config : system.diagnostics switches add name="Logowanie" value="Verbose" /switches /system.diagnostics How can I make TraceSwitch in my C# code that will be connected with this one "Logowanie" from…
CSharpBeginner
  • 1,625
  • 5
  • 22
  • 36