logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wang, Jason @ Newport MacArthur" <Jason.W...@cbre.com>
Subject RE: Windows Service
Date Wed, 13 Jul 2005 01:58:33 GMT
Baron and gang,

 

      I wasn't able to find XmlConfiguration.Configure(), but
log4net.Config.BasicConfigurator.Configure() worked for me.  

 

      HOWEVER, with the same configuration, I'm getting the following errors
(The last few lines are pertinent).  What fileName parameter?!

 

[4848] log4net: DefaultRepositorySelector: defaultRepositoryType
[log4net.Repository.Hierarchy.Hierarchy] 

[4848] log4net: DefaultRepositorySelector: creating repository for assembly
[EmailService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null] 

[4848] 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] 

[4848] log4net: DefaultRepositorySelector: creating repository for domain
[log4net-default-domain] using type [log4net.Repository.Hierarchy.Hierarchy]


[4848] log4net: DOMConfigurator: configuring repository
[log4net-default-domain] using file
[c:\EmailService\EmailService.exe.config] watching for file updates 

[4848] log4net: DOMConfigurator: configuring repository
[log4net-default-domain] using file
[c:\EmailService\EmailService.exe.config] 

[4848] log4net: DOMConfigurator: loading config from file
[c:\EmailService\EmailService.exe.config] 

[4848] log4net: DOMConfigurator: debug attribute= "true". 

[4848] log4net: DOMConfigurator: DOMConfigurator: Threshold ="". 

[4848] log4net: DOMConfigurator: Level value for root is  [DEBUG]. 

[4848] log4net: DOMConfigurator: root level set to DEBUG 

[4848] log4net: DOMConfigurator: Loading Appender [EventLogAppender] type:
[log4net.Appender.EventLogAppender] 

[4848] log4net: DOMConfigurator: Parsing layout of class:
"log4net.Layout.PatternLayout" 

[4848] log4net: EventLogAppender: Source [EmailService.exe] is registered to
log [Application] 

[4848] log4net: DOMConfigurator: Created Appender [EventLogAppender] 

[4848] log4net: DOMConfigurator: Adding appender named [EventLogAppender] to
logger [root]. 

[4848] log4net: DOMConfigurator: Loading Appender [RollingLogFileAppender]
type: [log4net.Appender.RollingFileAppender] 

[4848] log4net: DOMConfigurator: Parsing layout of class:
"log4net.Layout.PatternLayout" 

[4848] log4net: RollingFileAppender: Type = [0], r0 = [.1969-12-31], r1 =
[.1969-12-31] 

[4848] log4net: RollingFileAppender: Type = [1], r0 = [.1969-12-31], r1 =
[.1969-12-31] 

[4848] log4net: RollingFileAppender: Type = [2], r0 = [.1969-12-31], r1 =
[.1970-01-01] 

[4848] log4net:ERROR DOMConfigurator: Could not create Appender
[RollingLogFileAppender] of type [log4net.Appender.RollingFileAppender].
Reported error follows. 

[4848] System.ArgumentNullException: Value cannot be null. 

[4848] Parameter name: fileName 

[4848]    at System.IO.FileInfo..ctor(String fileName) 

[4848]    at
log4net.Appender.RollingFileAppender.DetemineCurSizeRollBackups() 

[4848]    at log4net.Appender.RollingFileAppender.ActivateOptions() 

[4848]    at
log4net.Repository.Hierarchy.DOMHierarchyConfigurator.ParseAppender(XmlEleme
nt appenderElement) 

[4848] log4net:ERROR DOMConfigurator: Appender named
[RollingLogFileAppender] not found.

 

-----Original Message-----
From: Baron Schwartz [mailto:baron@sequent.org] 
Sent: Tuesday, July 12, 2005 5:56 PM
To: Log4NET User
Subject: RE: Windows Service

 

Try

 

XmlConfigurator.Configure();

 

That's what I do.  I think there are some limitations to it, though.  I 

don't think you will be able to watch the file, as it's actually loaded by 

the framework instead of by log4net, and the framework doesn't watch the 

file.  I don't need this, so it always works fine for me.

 

-- 

Two antennae met on a roof, fell in love and got married.  The ceremony

was nice, but the reception was fantastic.

 

On Tue, 12 Jul 2005, Wang, Jason @ Newport MacArthur wrote:

 

> If I want to use the default configuration file (eg,

> MyApplication.exe.config), do I need to call ConfigureAndWatch?

> 

> 

> 

> -----Original Message-----

> From: Ron Grabowski

> Sent: Tuesday, July 12, 2005 5:30 PM

> To: Log4NET User

> Subject: RE: Windows Service

> 

> 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