Ryan,

log4net 1.2 beta 8 uses AppDomain.CurrentDomain.BaseDirectory as the
base path for relative file paths. In an ASP.NET hosted application this
is the path to the root of the application not the SYSTEM32 directory.

I use the following appender config for my web app:

<appender name="File" type="log4net.Appender.FileAppender">
  <file value="log\\WebUI.log" />
  <appendToFile value="true" />
  <layout type="log4net.Layout.PatternLayout">
    <conversionPattern value="%d [%t] %-5p %c [%x] - %m%n" />
  </layout>
</appender>

To see the full path that the appender is trying to open, and any errors
that may be occurring, you need to enable internal logging.
http://logging.apache.org/log4net/release/manual/faq.html#internalDebug
As you are running a web service you will probably need to use the
DebugView tool from http://www.sysinternals.com  to capture the
messages.

This sort of question should probably be discussed on the log4net-user
list rather than the log4net-dev list.
See http://logging.apache.org/log4net/support.html for details on
subscribing and posting.

Cheers,
Nicko

> -----Original Message-----
> From: Beaver, Ryan [mailto:[EMAIL PROTECTED] 
> Sent: 06 January 2005 16:25
> To: 'Log4NET Dev'
> Subject: RE: Log4Net default application path
> 
> Hey Nick,
> 
> I double checked and gave that a shot, substituting 
> Logs\\Application.Log. I am using this from an ASP.NET 
> webservice, could it be possible that its trying to through 
> it in SYSTEM32 or something and it doesnt have permissions. 
> (I did check for the logs there also).
> 
> Thanks,
> Ryan
> 
> -----Original Message-----
> From: Nicko Cadell [mailto:[EMAIL PROTECTED]
> Sent: Thursday, January 06, 2005 9:19 AM
> To: Log4NET Dev
> Subject: RE: Log4Net default application path
> 
> 
> Ryan,
> 
> Relative paths should work correctly. Make sure that your 
> relative path does not start with a slash (\) as that would 
> make it an absolute path for the current drive.
> 
> Nicko 
> 
> > -----Original Message-----
> > From: Beaver, Ryan [mailto:[EMAIL PROTECTED]
> > Sent: 03 January 2005 14:20
> > To: '[email protected]'
> > Subject: Log4Net default application path
> > 
> > 
> > Hello All,
> > 
> > I searched the archives and couldn't find anything exactly like my 
> > current problem. Im using a fileappender with my webservice. I want 
> > the the logging file to reside in (application directory)\logs\. I 
> > found some posts saying that you can just use 
> \\logs\\application.log 
> > in your appender, but this doesnt seem to work for me. If I use a 
> > direct path, it creates the file and works fine, just not 
> for relative 
> > paths. I apoligize for the newbee question, here is my 
> appender, any 
> > help on how to get this to work relative to my application 
> path would 
> > be greatly appreciated;
> > 
> >   <configSections>
> >     <section name="log4net"
> > type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
> >   </configSections>
> > 
> >     <log4net debug="false">
> >             <appender name="LogFileAppender"
> > type="log4net.Appender.FileAppender,log4net" >
> >                     <param name="File"
> > value="C:\\UserBridgeServiceLog.txt" />
> >                     <param name="AppendToFile" value="true" />
> >                     <layout
> > type="log4net.Layout.PatternLayout,log4net">
> >                             <param name="ConversionPattern" 
> > value="%d [%t] %-5p %c [%x] - %m%n" />
> >                     </layout>
> >             </appender>
> >             <root>
> >                     <priority value="DEBUG" />
> >                     <appender-ref ref="LogFileAppender" />
> >             </root>
> >     </log4net>
> > 
> > Thanks!
> > Ryan
> > 
> > 
> > Emphasys is interested in your ideas.  Visit our new online 
> suggestion 
> > box at http://www.emphasysworld.com/sub/feedback.asp to share your 
> > thoughts for nonsoftware-related improvements.  You could 
> win a free 
> > pass to the 2005 Annual User Conference!
> > 
> > 
> > 
> 
> 
> Emphasys is interested in your ideas.  Visit our new online suggestion
> box at http://www.emphasysworld.com/sub/feedback.asp to share 
> your thoughts
> for nonsoftware-related improvements.  You could win a free pass to
> the 2005 Annual User Conference!
> 
> 
> 

Reply via email to