I have noticed that Windows Services seem to be run from the Windows directory, and not the location of the binary. I don't know why this is. But I've always had to use a fully qualified path for service apps.

On Tue, 12 Jul 2005, Ron Grabowski wrote:

The SDK documentation for the File property of the FileAppender says

"
If the path is relative it is taken as relative from the application
base directory.
"

That line also appears in Visual Studio's Intellisense when you create
a FileAppender and hover over the File property.

I have a directory in root of my website called Logs where I keep two
files: log4net.txt and ProjectName.txt. This is how I set the File
property of my FileAppender:

<file value="Logs\ProjectName.txt" />

Here's a link to a thread with more examples:

http://tinyurl.com/d6b2c
http://www.mail-archive.com/log4net-user%40logging.apache.org/msg00881.html

The configuration guide for FileAppender:

http://tinyurl.com/7sqon
http://logging.apache.org/log4net/release/config-examples.html#fileappender

doesn't seem to mention where the file path is relative to. That should
probably be changed.

--- "Esterbrooks, Brette" <[EMAIL PROTECTED]> wrote:

Jason your config file looks fine. Most of my experience is ASP.NET
apps. However in all of my RollingFileAppenders I have to put a fully
qualified path in the value of the file tag. I am not sure if this is
something that is only needed in asp.net apps but the Log4Net
"Documentation" left that out and that held me up for a bit and I saw
the same thing happen as you are seeing now. Who knows. This
framework
can really be a pain.

B


-----Original Message-----
From: Wang, Jason @ Newport MacArthur [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 12, 2005 3:53 PM
To: 'Log4NET User'
Subject: RE: Windows Service



Brette,

            What about Windows Service using the rolling file
appender?
If the .exe I registered as a Windows Service is stored in
C:\MyService,
technically, the log file should be created in there as well right?
What stumps me is that Filemon from Sysinternals did not detect any
permission denied tries that may indicate some sorts of a user/file
permission cause.

Thanks,

Jason



  _____

From: Esterbrooks, Brette [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 12, 2005 12:30 PM
To: Log4NET User
Subject: RE: Windows Service



I have run into this problem when trying to log to event log. It
ended
up being that the user that was running log4net did not have access
to
log to the event log. Have you tried taking out the event log
appender
and seeing if the file appender is working?



Brette

-----Original Message-----
From: Wang, Jason @ Newport MacArthur [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 12, 2005 2:23 PM
To: '[email protected]'
Subject: Windows Service

I'm having trouble getting log4net working in my Windows Service
application.  Root is setup to use both event log appender and
rolling
log file appender but nothing is logged  (No exception thrown
either).
What is the best way to troubleshoot?



Thanks,



Jason





Reply via email to