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:[EMAIL PROTECTED]
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" <[EMAIL PROTECTED]> 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:[EMAIL PROTECTED]
> Sent: Tuesday, July 12, 2005 1:55 PM
> To: Log4NET User
> Subject: RE: Windows Service
>
>
>
> Try debugging to see if you are getting configured right. Make sure
> the
> config file is getting read properly.
>
>
>
> If the event log AND the file logging both fail, that points to
> something
> higher in the tree.
>
>
>
> and enable debugging on log4net.
>
>
>
> _____
>
> From: Wang, Jason @ Newport MacArthur [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, July 12, 2005 1: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,
>
=== message truncated ===