Click here to Skip to main content
16,004,919 members
Home / Discussions / C#
   

C#

 
Generalvolume name of a CD Pin
novadProt3-May-05 11:45
novadProt3-May-05 11:45 
GeneralRe: volume name of a CD Pin
Dan_P3-May-05 18:44
Dan_P3-May-05 18:44 
GeneralRe: volume name of a CD Pin
novadProt4-May-05 7:33
novadProt4-May-05 7:33 
GeneralBorder around PictureBox Pin
Anonymous3-May-05 11:14
Anonymous3-May-05 11:14 
GeneralRe: Border around PictureBox Pin
MoustafaS3-May-05 12:17
MoustafaS3-May-05 12:17 
GeneralRe: Border around PictureBox Pin
Anonymous3-May-05 12:53
Anonymous3-May-05 12:53 
GeneralRe: Border around PictureBox Pin
MoustafaS3-May-05 13:00
MoustafaS3-May-05 13:00 
GeneralTraceSwitch Initialization Problem Pin
Peter Vertes3-May-05 11:12
Peter Vertes3-May-05 11:12 
Hi All,

I'm having a problem with TraceSwitches. When I create one it doesn't seem to read the values from the XML .config file and nothing gets logged. Here's what I have done:

1) I've created a TraceSwitch:

static public TraceSwitch Logger = new TraceSwitch("TDLog", "Application Log");


2) I created a file stream:

FileStream filestream = new FileStream("c:\mylogfile.log", FileMode.Create);


3) I've created a <b>TextWriterTraceListener</b>

private TextWriterTraceListener _logfile = new TextWriterTraceListener(filestream);


4) I've added the TextWriterTraceListener to the Listeners collection:

Trace.Listeners.Add(_logfile);


5) I've also set up a .config file to give startup parameters to the TraceSwitch (the config file is called: myapp.exe.config since my app is called: myapp.exe. Here is the contents o my .config file:

<configuration>
<system.diagnostics>
<switches>
<add name="TDLog" value="4" />
<trace autoflush="true" />
</switches>
</system.diagnostics>
</configuration>

When my app run the Trace Level is initiall set to OFF dispite the fact I set it to verbose explicitly inside the .config file. For good measure I've also added a #define TRACE in the top of my .cs file to no avail. Any ideas on what I'm doing wrong ? Thanks in advance...

-Pete
GeneralStrongly naming referenced COM components Pin
RB@Emphasys3-May-05 10:18
RB@Emphasys3-May-05 10:18 
QuestionIs Label serializable? Pin
Anonymous3-May-05 9:37
Anonymous3-May-05 9:37 
AnswerRe: Is Label serializable? Pin
DavidNohejl3-May-05 11:01
DavidNohejl3-May-05 11:01 
AnswerRe: Is Label serializable? Pin
Marc Clifton3-May-05 15:34
mvaMarc Clifton3-May-05 15:34 
AnswerRe: Is Label serializable? Pin
Mathew Hall3-May-05 16:44
Mathew Hall3-May-05 16:44 
GeneralNeed help: Referencing Main Form from a Class Library. Pin
CarolAnnLove3-May-05 8:33
CarolAnnLove3-May-05 8:33 
GeneralRe: Need help: Referencing Main Form from a Class Library. Pin
CarolAnnLove3-May-05 8:41
CarolAnnLove3-May-05 8:41 
GeneralRe: Need help: Referencing Main Form from a Class Library. Pin
MoustafaS3-May-05 9:11
MoustafaS3-May-05 9:11 
GeneralRe: Need help: Referencing Main Form from a Class Library. Pin
DavidNohejl3-May-05 9:37
DavidNohejl3-May-05 9:37 
QuestionShould I create a Dll? Pin
Anonymous3-May-05 8:27
Anonymous3-May-05 8:27 
AnswerRe: Should I create a Dll? Pin
Anonymous3-May-05 10:17
Anonymous3-May-05 10:17 
GeneralRe: Should I create a Dll? Pin
Anonymous3-May-05 10:44
Anonymous3-May-05 10:44 
GeneralRe: Should I create a Dll? Pin
DavidNohejl3-May-05 11:05
DavidNohejl3-May-05 11:05 
GeneralDLL Config File Pin
jklucker3-May-05 7:53
jklucker3-May-05 7:53 
GeneralRe: DLL Config File Pin
Dave Kreskowiak3-May-05 8:46
mveDave Kreskowiak3-May-05 8:46 
GeneralRe: DLL Config File Pin
jklucker3-May-05 8:54
jklucker3-May-05 8:54 
GeneralRe: DLL Config File Pin
DavidNohejl3-May-05 11:19
DavidNohejl3-May-05 11:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.