Questions tagged [tracesource]

61 questions
3
votes
2 answers

await Task.Run altering trace ActivityId on exit

I am trying to use the Trace.CorrelationManager.ActivityId to correlate log entries. However, I'm finding when this code finishes: var result = await Task.Run(() => LongRunningMethod()); The ActivityId has changed from what it was when it was…
user380689
  • 1,766
  • 4
  • 26
  • 39
2
votes
2 answers

How to format the Timestamp data when using TraceOptions.Timestamp

How can I format the Timestamp data that is printed when you set the TraceOutputOptions = TraceOptions.Timestamp? Im getting something like: Timestamp=41329240725 (real value that was written on the output text file) EDITED: I want something like…
Pedro77
  • 5,176
  • 7
  • 61
  • 91
2
votes
0 answers

How to get list of TraceSource's or retrieve a TraceSource by name?

I would like to change some trace settings dynamically in code. But I get stopped at the first step: How do I get an existing TraceSource object? Is there a way to retrieve a TraceSource by name? Or to get a list of all the existing TraceSource's?…
Jay
  • 26,876
  • 10
  • 61
  • 112
2
votes
1 answer

Write eventlog while using impersonation

For some reason when I use the impersonate option in web.config. Everything is fine, but one problem obsesses me that is the following error occurs while using System.Diagnostics.TraceSource to write to the…
Yunwei Dai
  • 43
  • 4
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
2
votes
2 answers

Asp.NET MVC, custom TextWriterTraceListener does not create a file

For MVC application custom listener does not create a log file when initializeData="CustomWeblog.txt" parameter is used, but initializeData="d:\CustomWeblog.txt" triggers file creation. What is the reason of such behaviour? Console application…
Anton Lyhin
  • 1,925
  • 2
  • 28
  • 34
2
votes
0 answers

VS2015: TraceSource Output in Test Explorer?

I've got a library that I'm trying to unit test. I use TraceSource to write out warning details, and as I have the unit tests set to run as part of the build, I'd like them to show up when the tests are run - particularly on failure. I've tried the…
2
votes
1 answer

Defining TraceSource logging configuration for C# libraries

I'm working on shipping a couple of libraries and I'm planning to use TraceSource to implement some diagnostic tracing in them. I also want to allow users to attach/configure their own listeners, switches, filters etc. Since libraries don't ship…
Kakira
  • 846
  • 1
  • 8
  • 14
2
votes
2 answers

Trace to different logfiles from the same application

First some background information about the situation. I have a main application (let's call it the Core) and some minor applications (let's call them Core jobs). The main job of the Core is to make sure, that every any given Core job is running…
2
votes
1 answer

TraceSource from referenced library not logging when programmatically added

Here is my config file from my Winforms application. Currently it has MyTraceSource commented out, and if I uncomment it and run my program it works as expected. I get output to my console from my referenced library. MyTraceSource is a Trace source…
Robert Snyder
  • 2,399
  • 4
  • 33
  • 65
2
votes
1 answer

TraceListener headers and footers

When writing a custom TraceListener how can I force the writeheader, the data/messsage, and the writefooter to be one discreet record? Specifically the custom tracelisteners in question write to a non file based source, such as database or event…
BozoJoe
  • 6,117
  • 4
  • 44
  • 66
2
votes
0 answers

Sharing configuration across multiple tracesources

I'm stuck with TraceSource configuration. I have a lot of TraceSource following the "one per class pattern" and now I would like to configure all of them in a app.config. Is it possible ? I add that the TraceSource are in a .dll and I would like to…
2
votes
4 answers

combine multiple tracesource filters in app.config

I want to configure a FileTraceListeners in my application, that ignores 'verbose' level messages but logs 'information' level and above as well as 'start' and 'stop' events. Everything is configured within the app.config file. However I cannot find…
HugoRune
  • 13,157
  • 7
  • 69
  • 144
2
votes
3 answers

Using TraceSource in Multithreaded environment

I have written an application in F# using asyncronous-workflows. Now what I'd like to do is to add some Tracing to it! There is basically a class A which can be instantiated several times. Each one of the instances is working independend…
matthid
  • 1,644
  • 16
  • 26
1
vote
2 answers

Format ApplicationData in Service Trace Viewer as XML

I'm using TraceSource to log information to a XmlWriterTraceListener. The message I'm logging is a XML, however, when I view the message in Service Trace Viewer, it's not displayed as a XML, it's displayed as a string. Is there a way to do…
Pascal
  • 2,944
  • 7
  • 49
  • 78