Walter thanks for your response!
I am still unable to get this to work.
I notice that this custom log writes to a file. Does this mean having the
network service account write to the application log is not recommended? I
would like my log to be visible from the Computer Management Snap-in.
From you advice and 2 msdn articles:
http://msdn2.microsoft.com/en-us/library/yhx0xwks.aspx
http://msdn2.microsoft.com/en-us/library/5cz98azz.aspx
This is the new version of the web.config file excerpt
<system.diagnostics>
<sources>
<!-- This section defines the logging configuration for
My.Application.Log -->
<source name="DefaultSource" switchName="DefaultSwitch">
<listeners>
<add name="FileLog"/>
<!-- Uncomment the below section to write to the Application Event Log -->
<!—
If writing to the event log is causing the problem I don’t believe we want
this listener to receive log messages anymore.
<add name="EventLog"/>
-->
<add name="FileLogListener" />
</listeners>
</source>
</sources>
<switches>
<add name="DefaultSwitch" value="Information"/>
</switches>
<sharedListeners>
<add name="FileLog"
type="Microsoft.VisualBasic.Logging.FileLogTraceLi stener,
Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
initializeData="FileLogWriter"/>
<!-- Uncomment the below section and replace APPLICATION_NAME (now
'APPLICATION_NAME') with the name of your application to write to the
Application Event Log -->
<!--
<add name="EventLog" type="System.Diagnostics.EventLogTraceListener"
initializeData="MySource"/>
-->
<add name="FileLogListener"
type="Microsoft.VisualBasic.Logging.FileLogTraceLi stener,
Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" initializeData="FileLogListenerWriter"
location="Custom" customlocation="C:\LogFiles\" />
</sharedListeners>
</system.diagnostics>
On my laptop running XP
My.Log.WriteEntry("Testing")
Creates a log file (“WebDev.WebServer.log “) in the correct location
(“C:\LogFiles\”) as expected however the log file remains empty without any
exceptions being thrown. So none of the messages are being recorded.
On the Win2003 Server
I still get the same error message:
"Access to the path 'C:\Documents and Settings\Default User\Application
Data\Microsoft Corporation\Internet Information Services\6.0.3790.1830' is
denied."
Note: I have given “Network Service” Full Control of “C:\LogFiles\”
And on the XP machine my web.config provided the correct information to
create the “WebDev.WebServer.log”.
I don’t know what is causing it to look in that folder. I have also tried
commenting out the FileLog listner entry ( <add name="FileLog"/> ) and the
sharedListner entry (
<add name="FileLog"
type="Microsoft.VisualBasic.Logging.FileLogTraceLi stener,
Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
initializeData="FileLogWriter"/>
) and I still get the same error.
Where you able to get this to work? Could you send me your webconfig file?
Thanks,
Jeff