473,406 Members | 2,847 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

how to configure in my app.config a TextWriterTraceListener to use System.Console.Out ?

hello

I'd like to add a listener in the app.config of my application, something like
<add name="myListener" type="System.Diagnostics.TextWriterTraceListener"/>
I can use initializeData="mylog.txt" to trace in a file but I 'd like to trace in
the console but I can't find how to do ... I can't see any samples of that in msdn
or elsewhere

thanks for your help
didier
Nov 16 '05 #1
1 6012
Didier Bolf <di*********@wanadoo.fr> wrote:
I'd like to add a listener in the app.config of my application, something like
<add name="myListener" type="System.Diagnostics.TextWriterTraceListener"/>
I can use initializeData="mylog.txt" to trace in a file but I 'd like to trace in
the console but I can't find how to do ... I can't see any samples of that in msdn
or elsewhere


I don't know about the trace listener side of things, but it sounds
like you want to redirect the console, so use Console.SetOut to set the
output to your own custom TextWriter which then writes the output
however you want it to.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Per Bergland | last post by:
After many woes, I finally managed to get a stack dump of my System Service (written in C#) that insists on crashing when launched at system boot time (see below on how to get this dump - I...
0
by: Ant Corrie | last post by:
I am at a loss as to why this is not working. I am trying to setup a TextWriterTraceListener in my application config file and then execute the app from the network. I get a security exception...
3
by: Daniel Billingsley | last post by:
The documentation on this subject seems to give you 98% of what you need to know. From various sources, I have compiled an understanding that this should work: <configuration>...
2
by: Richard | last post by:
Hi, I'm having trouble setting up a config file based trace switch & listener. I added an application config file to my console based C# program using the "Add New Application Config File" button...
0
by: Pete W | last post by:
I have a console application for which I have atttemped to use TextWriterTraceListener. The app uses System.Diagnostic I want to trace or debug to Console and also to file. code in Main()...
4
by: Jiho Han | last post by:
I have the following defined in web.config under <configuration> node: <system.diagnostics> <switches> <add name="MainSwitch" value="4"/> </switches>
3
by: Shawn Melton | last post by:
I cannot get a clean compile if I add Trace configuration info into my web.config. This generates an error: <configuration> <system.diagnostics> <switches> <add name="MyTraceSwitch" value="4"...
3
by: gslim | last post by:
I have created a trace listener and would like to give it a variable so that when it is installed on a machine I have no control over it can still find its logfile. Right now they are hardcoded as...
6
by: Peted | last post by:
Hi, im wanting to store some custom text strings in the app.config file of a c# app, to be retreived and updated when the app runs. using c# 2005 express in my testing i am using the code...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.