You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by sanjay K <sa...@dell.com> on 2010/03/17 08:12:00 UTC

Re: no log file generated

Tomas Ramirez <tomasr <at> windward.net> writes:

> 
> 
> Thanks, I’ll try that out when I get a chance.  But actually, I did figure 
this out last night – I just needed to call XmlConfigurator.Configure
(FileInfo) and explicitly tell the configurator where the xml file was.  I 
asked Mike Knowles about it and he updated his blog article about it with a 
full source code project specifically for sharepoint:
> 
http://mikeknowles.com/blog/2009/02/17/ConfiguringLog4netForSharePointWindowsAu
thentication.aspx
>  
> Thanks for the help!
> - Tomas
>  
> From: Cankut Eskin [mailto:cankuteskin <at> gmail.com] Sent: Wednesday, 
February 24, 2010 1:25 AMTo: Log4NET UserSubject: Re: no log file generated
>  
> Try enabling log4net internal debugging to see if something is going wrong. 
How to enable internal debugging is described in 
http://logging.apache.org/log4net/release/faq.htmlAnd make sure that the 
process running your application has permission to 
write/create "F:\arrowlog.txt".
> 
> On 24 February 2010 02:19, Tomas Ramirez <tomasr <at> windward.net> wrote:
> I've done some investigating, and here's what I noticed.  My web parts (in 
my dev environment) are capable of creating and writing to the file that I 
specified in the RollingFileAppender, so it shouldn't be any problem with 
permission to that file.  That makes me think that it must be a problem with 
log4net getting the configuration information in the first place.  But I'm 
just theorizing, in hopes that this will help someone help me figure out 
what's going on.- Tomas
> -----Original Message-----From: Tomas Ramirez [mailto:tomasr <at> 
windward.net]Sent: Tuesday, February 23, 2010 3:02 PMTo: log4net-user <at> 
logging.apache.orgSubject: no log file generatedHi, I'm trying to use log4net 
in sharepoint web parts, but no log file is being generated.  Is there 
something I'm forgetting to do?  Here's what I've got:I've got a web part that 
calls:       log4net.Config.XmlConfigurator.Configure();       ILog log = 
LogManager.GetLogger(typeof(DataDefinitionWebPart));       log.Fatal
(String.Format("{0}\n{1}\n{2}", ex.Message, ex.Source, ex.StackTrace));Then in 
my web config, I have a log4net section in configSections       <section 
name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, 
log4net" />And I here's what I have in the log4net 
section: <log4net>   <appender name="ConsoleAppender" 
type="log4net.Appender.ConsoleAppender">     <layout 
type="log4net.Layout.PatternLayout">       <param name="ConversionPattern" 
value="[%t] ac.server %-5p %c - %m%
n" />     </layout>   </appender>   <appender name="TraceAppender" 
type="log4net.Appender.TraceAppender">     <layout 
type="log4net.Layout.PatternLayout">       <param name="ConversionPattern" 
value="[%t] ac.server %-5p %c - %m%
n" />     </layout>   </appender>   <appender name="RollingFileAppender" 
type="log4net.Appender.RollingFileAppender">     <!-- This is where your log 
is saved -->     <param name="File" 
value="F:\arrowlog.txt" />     <appendToFile value="true" />     <rollingStyle 
value="Date" />     <datePattern value=".yyyy-MM-dd" />     <layout 
type="log4net.Layout.PatternLayout">       <param name="ConversionPattern" 
value="%d [%t] ac.server %-5p %c - %m%
n" />     </layout>   </appender>   <root>     <level 
value="DEBUG" />     <appender-ref ref="ConsoleAppender" />     <appender-ref 
ref="TraceAppender" />     <appender-ref 
ref="RollingFileAppender" />   </root> </log4net>Thanks!- Tomas
> 
> -- Cankut Eskin
> 


Hi Tomas,

I'm trying to get the same working. What is the file whose name need to pass 
in to the call XmlConfigurator.Configure(FileInfo). Does the FileInfo points 
to the Web.config file, which contains the log4.net configurations? Mike's 
blog still does not show how to pass in the file name (or what is the file 
name).

Thanks,
Sanjay