<system.diagnostics> in web.config

J

Jiho Han

I have the following defined in web.config under <configuration> node:

<system.diagnostics>

<switches>

<add name="MainSwitch" value="4"/>

</switches>

<trace autoflush="true" indentsize="4">

<listeners>

<add name="myListenere" type="System.Diagnostics.TextWriterTraceListener"
initializeData="c:\myListener.log" />

</listeners>

</trace>

</system.diagnostics>

When I tried to load a page, I get a configuration exception that says there
was an exception in configuration section handler. Can some tell me what is
wrong with this configuration?



Thanks
 
G

George Durzi

Wild guess, but what if you escape the \ in ="c:\myListener.log" /> by doing
=@"C:\myListener.lob"/>
 
J

Jiho Han

I'd try that but even before trying, that wouldn't be a well-formed xml,
would it?
 
G

George Durzi

Yeah, nevermind.. I took your Xml snippet and stuck it in my web.config file
and everything was ok.

Here's my web.config file, I just deleted everything in <appsettings> for
brevity

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>

</appSettings>
<system.web>
<compilation defaultLanguage="c#" debug="true" />
<customErrors mode="RemoteOnly" />
<authentication mode="Forms">
<forms loginUrl="login.aspx" name="adAuthCookie" timeout="240" path="/"
/>
</authentication>
<authorization>
<deny users="?" />
<allow users="*" />
</authorization>
<identity impersonate="true"></identity>
<trace enabled="false" requestLimit="10" pageOutput="true"
traceMode="SortByTime" localOnly="true" />
<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;user id=sa;password="
cookieless="false" timeout="240" />
<globalization requestEncoding="utf-8" responseEncoding="utf-8" />
</system.web>
<system.diagnostics>
<switches>
<add name="MainSwitch" value="4" />
</switches>
<trace autoflush="true" indentsize="4">
<listeners>
<add name="myListenere"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="c:\myListener.log" />
</listeners>
</trace>
</system.diagnostics>
</configuration>
 
J

Jiho Han

I see you have asp.net tracing turned off. (<trace enabled="false">) Maybe
that's it? Hmm...
I got a lot of stuff happening in web.config. So maybe I should try it on a
default one.
Have you tried writing to trace, and did you get output in your specified
file?

BTW, I decided that I am going to use log4net for my tracing but it'd still
be useful to know whether this works or not.

Thanks for your help.
Jiho
 
Joined
Feb 19, 2008
Messages
1
Reaction score
0
How to get over this problem??

I have a similar issue. Did you manage to get over the problem? If so, please tel me how.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top