473,396 Members | 2,082 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,396 software developers and data experts.

Problem with loading app.config

DoB
Hi,

I was trying to configure the Trace class using the app.config. I was
followig the example configurations in the MSDN.
However, as I debug the program, the Trace class seems to ignore the
configuration. For example - it has its default and only listener while I
removed it and added some other listeners in a config file.

Am I missing something? Is any explicit call needed to load the trace
configuration part?

DoB
Dec 20 '07 #1
3 1775
"DoB" <Do*@dob.comwrote in news:uR**************@TK2MSFTNGP03.phx.gbl:
Hi,

I was trying to configure the Trace class using the app.config. I was
followig the example configurations in the MSDN.
However, as I debug the program, the Trace class seems to ignore the
configuration. For example - it has its default and only listener
while I removed it and added some other listeners in a config file.

Am I missing something? Is any explicit call needed to load the trace
configuration part?
Hi - I think you need to be aware that "app.config" is not the real name of
the configuration file your program uses (at least as far as I have seen).
This might be the name you see in Visual Studio, but when you compile the
file is automatically renamed to something like
"application_name.exe.config".

So check this file exists and is in the right place.

/Peter
Dec 20 '07 #2
<configuration>
<system.diagnostics>
<switches>
<add name="DemoApp.Switch" value="Information"/>
</switches>
<trace autoflush="true" indentsize="5">
<listeners>
<add name="DemoListener" type="System.Diagnostics.XmlWriterTraceListener"
initializeData="output.xml" />
<remove name="Default" />

<add name="DemoListener"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="output.txt" />
<remove name="Default" />
<add name="DemoListener"
type="System.Diagnostics.DelimitedListTraceListene r"
delimiter="|"
initializeData="C:\\output.txt"/>
<remove name="Default" />

</listeners>
</trace>

</system.diagnostics>
</configuration>
i have different listener u can use it according to uer convience
"DoB" wrote:
Hi,

I was trying to configure the Trace class using the app.config. I was
followig the example configurations in the MSDN.
However, as I debug the program, the Trace class seems to ignore the
configuration. For example - it has its default and only listener while I
removed it and added some other listeners in a config file.

Am I missing something? Is any explicit call needed to load the trace
configuration part?

DoB
Dec 20 '07 #3
DoB
OK. Solved.
It was actually loading, but the configuration was incorrect :-)
Sorry for troubling.

DoB
Dec 21 '07 #4

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

Similar topics

1
by: Joe | last post by:
Hi Does anyone know of any issues about loading config files for windows forms applications? I have an application that utilizes a config file that holds my database connection string as well...
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...
3
by: Sai Pavan | last post by:
Error loading XML file c:\winnt\microsoft.net\framework\v1.0.3705\Config\machine.config Request for the permission of type System.Security.Permissions.StrongNameIdentityPermission, mscorlib,...
1
by: Sai Pavan | last post by:
I'm doing asp.net application. In my web.config file i have added key as following <appSettings> <add key="Provider" value="3"></add> <add key="OracleClient" value="data source=global;user...
2
by: Sai Pavan | last post by:
I'm developing a web application i.e. asp.net. I have added a key named "Provider" in web.config file as follows <appSettings> <add key="Provider" value="3"></add> <add key="OracleClient"...
2
by: tony.ha | last post by:
Hello, I have downloaded the PyPE2.1-win-unicode.zip, after unzip it with winzip into PyPE2.1-win-unicode dierctory on window XP. I try to run "pype.exe" by double click on it, but nothing has...
2
by: Eric Johannsen | last post by:
We have a DLL that we're testing with NUnit (from GotDotNet). We want to put some configuration information for the DLL into app.config in the appSettings section. For some reason our settings...
0
by: Roy Chastain | last post by:
I have a simple page or two and a simple global.asax file that loads some configuration from the web.config file. I developed this on a Windows XP box with framework version 1.1 installed. I run...
5
by: Mikko Penkkimäki | last post by:
Hi Looks like I can not change Web page's timeout setting. In practise it's all the time 20 minutes - no matter what I do. I have this kind of setting in web.config: <sessionState...
0
by: BrianKer | last post by:
Hi! It's my first discussion on this forum. First I have a exe like this below (the object can invoke by console) public class DynamicLoad { public Type AssemblyType = null; ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.