logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ron Grabowski <rongrabow...@yahoo.com>
Subject RE: Windows Service
Date Wed, 13 Jul 2005 00:29:31 GMT
You need to call Configure at some point or else log4net won't
configure itself. I usually call ConfigureAndWatch(FileInfo) then write
a message indicating my application has started: log.Info("Application
Started")

--- "Wang, Jason @ Newport MacArthur" <Jason.Wang@cbre.com> wrote:

> All,
> 
> 	Currently, I started calling log.Debug("...") with just,
> 
> 	private static readonly log4net.ILog log =
> log4net.LogManager.GetLogger(typeof(EmailServiceStarter));          
> 
> 	Should I switch to manually load the configuration file? Such as,
> 
> 	log4net.Config.DOMConfigurator.ConfigureAndWatch(new
> System.IO.FileInfo("c:\\EmailService\\EmailService.exe.config")); ?
> 
> 	As you can tell from my previous post, the .config file is not
> exclusive to log4net so I don't understand why my main app can read
> the
> .config file, but log4net can't.
> 
> Thanks,
> 
> Jason
>           
> 
> 
> -----Original Message-----
> From: Ron Grabowski [mailto:rongrabowski@yahoo.com] 
> Sent: Tuesday, July 12, 2005 5:24 PM
> To: Log4NET User
> Subject: RE: Windows Service
> 
> What does your call to Configure look like?
> 
> --- "Wang, Jason @ Newport MacArthur" <Jason.Wang@cbre.com> wrote:
> 
> > I'm stuck.  I can't figure out what would cause the "No appenders
> > could be
> > found for logger" error.  Is it possible that log4net isn't reading
> > the
> > config file corrently?
> > 
> >  
> > 
> > Thanks,
> > 
> >  
> > 
> > Jason
> > 
> >   _____  
> > 
> > From: Wang, Jason @ Newport MacArthur 
> > Sent: Tuesday, July 12, 2005 2:50 PM
> > To: 'Log4NET User'
> > Subject: RE: Windows Service
> > 
> >  
> > 
> > All,
> > 
> >  
> > 
> >       Per Erik's suggestion I turned on debugging and downloaded
> > sysinternal's DebugView and found the following 2 entries:
> > 
> >  
> > 
> > [2136] log4net: DefaultRepositorySelector: defaultRepositoryType
> > [log4net.Repository.Hierarchy.Hierarchy] 
> > 
> > [2136] log4net: DefaultRepositorySelector: creating repository for
> > assembly
> > [EmailService, Version=1.0.0.0, Culture=neutral,
> PublicKeyToken=null]
> > 
> > 
> > [2136] log4net: DefaultRepositorySelector: assembly [EmailService,
> > Version=1.0.0.0, Culture=neutral, PublicKeyToken=null] using domain
> > [log4net-default-domain] and repository type
> > [log4net.Repository.Hierarchy.Hierarchy] 
> > 
> > [2136] log4net: DefaultRepositorySelector: creating repository for
> > domain
> > [log4net-default-domain] using type
> > [log4net.Repository.Hierarchy.Hierarchy]
> > 
> > 
> > [2136] log4net:ERROR Logger: No appenders could be found for logger
> > [Company.Project.EmailService.EmailServiceStarter] 
> > 
> > [2136] log4net:ERROR Logger: Please initialize the log4net system
> > properly.
> > 
> >  
> > 
> >  
> > 
> >       Below is my EmailService.exe.config.  What am I missing?
> > 
> >  
> > 
> > Thanks,
> > 
> >  
> > 
> > Jason
> > 
> >  
> > 
> > <?xml version="1.0" encoding="utf-8" ?>
> > 
> > <configuration>
> > 
> >       <configSections>
> > 
> >             <section name="log4net"
> > type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"
> />
> > 
> >       </configSections>
> > 
> >       <appSettings>
> > 
> >             <add key="runinterval" value="60000" />
> > 
> >       </appSettings>    
> > 
> >       <log4net debug="true">
> > 
> >             <!-- Define some output appenders -->
> > 
> >             <appender name="RollingLogFileAppender"
> > type="log4net.Appender.RollingFileAppender">
> > 
> >                   <file value="c:\EmailSerivceLog.txt" />
> > 
> >                   <appendToFile value="true" />
> > 
> >                   <maxSizeRollBackups value="5" />
> > 
> >                   <maximumFileSize value="100" />
> > 
> >                   <rollingStyle value="Size" />
> > 
> >                   <staticLogFileName value="true" />
> > 
> >                   <layout type="log4net.Layout.PatternLayout">
> > 
> >                         <header value="[Header]
> " />
> > 
> >                         <footer value="[Footer]
> " />
> > 
> >                         <conversionPattern value="%date [%thread]
> > %-5level
> > %logger [%ndc] - %message%newline" />
> > 
> >                   </layout>
> > 
> >             </appender>
> > 
> >             <appender name="EventLogAppender"
> > type="log4net.Appender.EventLogAppender" >
> > 
> >                   <applicationName value="APT - Email Service" />
> > 
> >                   <layout type="log4net.Layout.PatternLayout">
> > 
> >                         <conversionPattern value="%date [%thread]
> > %-5level
> > %logger [%property{NDC}] - %message%newline" />
> > 
> >                   </layout>
> > 
> >             </appender>
> > 
> >             <!-- Setup the root category, add the appenders and set
> > the
> > default level -->
> > 
> >             <root>
> > 
> >                   <level value="DEBUG" />
> > 
> >                   <appender-ref ref="EventLogAppender" />
> > 
> >                   <appender-ref ref="RollingLogFileAppender" />
> > 
> >             </root>
> > 
> >       </log4net>
> > 
> > </configuration>
> > 
> >   _____  
> > 
> > From: Sargent, Erik [mailto:Erik.Sargent@providence.org] 
> > Sent: Tuesday, July 12, 2005 1:55 PM
> > To: Log4NET User
> > Subject: RE: Windows Service
> > 
> >  
> 
=== message truncated ===


Mime
View raw message