RE: No appenders found
Do you have a XmlConfigurator.Configure(); Or one of the other possibilities to configure log4net somewhere in your code ? -- Wolfgang From: Sidharth Nayyar [mailto:sidharth.nay...@pulsion.co.uk] Sent: Mittwoch, 19. August 2009 11:43 To: log4net-user@logging.apache.org Subject: No appenders found Hello all, I'm new to log4net, so sorry for the really basic question! I've added this to the web.config of my site: section name=log4net type=log4net.Config.Log4NetConfigurationSectionHandler, log4net / . log4net appender name=EventLogAppender type=log4net.Appender.EventLogAppender applicationName value=LoggingTest / layout type=log4net.Layout.PatternLayout conversionPattern value=%date [%thread] %-5level %logger [%property{NDC}] - %message%newline / /layout /appender appender name=RollingFileAppender type=log4net.Appender.RollingFileAppender file value=logfile / appendToFile value=true / rollingStyle value=Composite / datePattern value=MMdd / maxSizeRollBackups value=10 / maximumFileSize value=1MB / layout type=log4net.Layout.PatternLayout conversionPattern value=%date [%thread] %-5level %logger [%property{NDC}] - %message%newline / /layout /appender appender name=SmtpAppender type=log4net.Appender.SmtpAppender,log4net to value=t...@test.com / from value=f...@from.com / subject value= Warning / smtpHost value=mail-relay.company.co.uk / bufferSize value=512 / lossy value=false / evaluator type=log4net.Core.LevelEvaluator,log4net threshold value=WARN / /evaluator layout type=log4net.Layout.PatternLayout,log4net conversionPattern value=%property{log4net:HostName} :: %level :: %message %newlineLogger: %logger%newlineThread: %thread%newlineDate: %date%newlineNDC: %property{NDC}%newline%newline / /layout /appender !-- Set root logger level to DEBUG and its only appender to A1 -- root level value=DEBUG / appender-ref ref=RollingFileAppender / /root logger name=MyLogger level value=WARN / appender-ref ref=EventLogAppender / appender-ref ref=SmtpAppender / appender-ref ref=RollingFileAppender / /logger /log4net And in my code I have this: private static ILog _defaultLog; . _defaultLog = log4net.LogManager.GetLogger(MyLogger); _defaultLog.Error(test); However nothing gets written to event log, file or smtp. While debugging there doesn't seem to be any appenders to the repository. So I'm presuming I haven't set up my configuration properly. Unfortunately I can't see where I'm going wrong - can you see where I'm going wrong? Thanks in advance. Regards Sidharth
No appenders found
Hello all, I'm new to log4net, so sorry for the really basic question! I've added this to the web.config of my site: section name=log4net type=log4net.Config.Log4NetConfigurationSectionHandler, log4net / ... log4net appender name=EventLogAppender type=log4net.Appender.EventLogAppender applicationName value=LoggingTest / layout type=log4net.Layout.PatternLayout conversionPattern value=%date [%thread] %-5level %logger [%property{NDC}] - %message%newline / /layout /appender appender name=RollingFileAppender type=log4net.Appender.RollingFileAppender file value=logfile / appendToFile value=true / rollingStyle value=Composite / datePattern value=MMdd / maxSizeRollBackups value=10 / maximumFileSize value=1MB / layout type=log4net.Layout.PatternLayout conversionPattern value=%date [%thread] %-5level %logger [%property{NDC}] - %message%newline / /layout /appender appender name=SmtpAppender type=log4net.Appender.SmtpAppender,log4net to value=t...@test.com / from value=f...@from.com / subject value= Warning / smtpHost value=mail-relay.company.co.uk / bufferSize value=512 / lossy value=false / evaluator type=log4net.Core.LevelEvaluator,log4net threshold value=WARN / /evaluator layout type=log4net.Layout.PatternLayout,log4net conversionPattern value=%property{log4net:HostName} :: %level :: %message %newlineLogger: %logger%newlineThread: %thread%newlineDate: %date%newlineNDC: %property{NDC}%newline%newline / /layout /appender !-- Set root logger level to DEBUG and its only appender to A1 -- root level value=DEBUG / appender-ref ref=RollingFileAppender / /root logger name=MyLogger level value=WARN / appender-ref ref=EventLogAppender / appender-ref ref=SmtpAppender / appender-ref ref=RollingFileAppender / /logger /log4net And in my code I have this: private static ILog _defaultLog; ... _defaultLog = log4net.LogManager.GetLogger(MyLogger); _defaultLog.Error(test); However nothing gets written to event log, file or smtp. While debugging there doesn't seem to be any appenders to the repository. So I'm presuming I haven't set up my configuration properly. Unfortunately I can't see where I'm going wrong - can you see where I'm going wrong? Thanks in advance. Regards Sidharth
RE: Experiencing locks while using AdoNetAppender
Ron and Michael thanks for your suggestions, It is indeed how SQLite works and the locking itself is not the problem. This is expected as multiple processes try to log at once. The ADODBAppender uses a internal buffer to store the logevents. The problem is that with default timeout for the DBCommand of 30 seconds (which is specified in the ADODBAppender) I experience out of memory exceptions as the internal buffers grow too fast while waiting for the timeout. A timeout of say 5s would be better for me. Or better make the timeout configurable through the config file of the ADODBAppender. What would be the best way to make the neccessary changes? Create my own version of the ADODBAppender? Thanks for any reactions, Patrick Van: Ron Grabowski [mailto:rongrabow...@yahoo.com] Verzonden: Wednesday, August 19, 2009 3:36 AM Aan: Log4NET User Onderwerp: Re: Experiencing locks while using AdoNetAppender I think that's how SQLite works. Have you tried writing to a single .db file from multiple threads without using log4net? From: Patrick Kalkman p...@hoogendoorn.nl To: log4net-user@logging.apache.org Sent: Tuesday, August 18, 2009 8:29:17 AM Subject: Experiencing locks while using AdoNetAppender Hi, I am using the AdoNetAppender for logging messages from multiple application. All the applications log into one sqllite database. Sometimes when a lot of information is logged I am experiencing exceptions like: log4net:ERROR [AdoNetAppender] Exception while writing to database System.Data.SQLite.SQLiteException: The database file is locked database is locked at System.Data.SQLite.SQLite3.Reset(SQLiteStatement stmt) at System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt) at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery() at System.Data.SQLite.SQLiteTransaction..ctor(SQLiteConnection connection, Boolean deferredLock) at System.Data.SQLite.SQLiteConnection.BeginTransaction(Boolean deferredLock) at System.Data.SQLite.SQLiteConnection.BeginDbTransaction(IsolationLevel isolationLevel) at System.Data.Common.DbConnection.System.Data.IDbConnection.BeginTransacti on() at log4net.Appender.AdoNetAppender.SendBuffer(LoggingEvent[] events) The default CommandTimeout in the AdoNetAppender on the IDbCommand is 30 seconds, but I would like to influence this timeout in the log4net configuration (file) so that I can influence the timeout on the logging if the database is locked for a longer portion of time. Reducing the timeout may lead to events getting lost, but I prefer that to our application hanging for the full CommandTimeout waiting for the database to become unlocked. Is it possible to configure the timeout using configuration? or would it be better to choose for a solution like deriving from the AdoNetAppender and add the functionality? Thanks in advance for any answers. Patrick **DISCLAIMER** Deze E-mail is uitsluitend bestemd voor de geadresseerde(n). Verstrekking aan en gebruik door anderen is niet toegestaan. De Hoogendoorn Groep sluit iedere aansprakelijkheid uit die voortvloeit uit elektronische verzending. This E-mail is intended exclusively for the addressee(s), and may not be passed on to, or made available for use by any person other than the addressee(s). The Hoogendoorn Group rules out any and every liability resulting from any electronic transmission. *** This message has been scanned by Network Associates' McAfee AntiVirus Technology
RE: No appenders found
Thanks Ross, that's it logging now. Unfortunately it's only using the appenders as specified in the root element, even though I'm trying to access it by MyLogger name. So I presume MyLogger isn't registered with the default repository? Should I therefore create a new repository with MyLogger name in order to use that Logger? Also is there some documentation that shows all the configuration elements? I looked at the SDK but I couldn't find it. Thanks again for all your help. Regards, Sidharth From: Ross Hinkley [mailto:rosshink...@gmail.com] Sent: 19 August 2009 13:06 To: Log4NET User Subject: Re: No appenders found Sidharth, I think it depends on the log4net section handler you're using. That overload of configure has specifies that the configuration must use the Log4NetConfigurationSectionHandler. See: http://logging.apache.org/log4net/release/sdk/log4net.Config.XmlConfigurator.Configure_overload_2.html for more information. Alternatively, you could try the following in your code: log4net.Config.XmlConfigurator.Configure(new FileInfo(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile)); -Ross On Wed, Aug 19, 2009 at 5:11 AM, Sidharth Nayyar sidharth.nay...@pulsion.co.ukmailto:sidharth.nay...@pulsion.co.uk wrote: Hi Wolfgang, Thanks for your quick response. I've added this to the code now: if (!_defaultLog.Logger.Repository.Configured) { log4net.Config.XmlConfigurator.Configure(_defaultLog.Logger.Repository); } But the repository is still appearing as unconfigured and still no appenders. I've even tried doing a default XmlConfigurator.Configure(); before GetLogger() call. Is that the right way of calling the Configure() method? Sidharth From: Wolfgang Trog [mailto:wolfg...@wollinet.commailto:wolfg...@wollinet.com] Sent: 19 August 2009 10:49 To: 'Log4NET User' Subject: RE: No appenders found Do you have a XmlConfigurator.Configure(); Or one of the other possibilities to configure log4net somewhere in your code ? -- Wolfgang From: Sidharth Nayyar [mailto:sidharth.nay...@pulsion.co.ukmailto:sidharth.nay...@pulsion.co.uk] Sent: Mittwoch, 19. August 2009 11:43 To: log4net-user@logging.apache.orgmailto:log4net-user@logging.apache.org Subject: No appenders found Hello all, I'm new to log4net, so sorry for the really basic question! I've added this to the web.config of my site: section name=log4net type=log4net.Config.Log4NetConfigurationSectionHandler, log4net / ... log4net appender name=EventLogAppender type=log4net.Appender.EventLogAppender applicationName value=LoggingTest / layout type=log4net.Layout.PatternLayout conversionPattern value=%date [%thread] %-5level %logger [%property{NDC}] - %message%newline / /layout /appender appender name=RollingFileAppender type=log4net.Appender.RollingFileAppender file value=logfile / appendToFile value=true / rollingStyle value=Composite / datePattern value=MMdd / maxSizeRollBackups value=10 / maximumFileSize value=1MB / layout type=log4net.Layout.PatternLayout conversionPattern value=%date [%thread] %-5level %logger [%property{NDC}] - %message%newline / /layout /appender appender name=SmtpAppender type=log4net.Appender.SmtpAppender,log4net to value=t...@test.commailto:t...@test.com / from value=f...@from.commailto:f...@from.com / subject value= Warning / smtpHost value=mail-relay.company.co.ukhttp://mail-relay.company.co.uk / bufferSize value=512 / lossy value=false / evaluator type=log4net.Core.LevelEvaluator,log4net threshold value=WARN / /evaluator layout type=log4net.Layout.PatternLayout,log4net conversionPattern value=%property{log4net:HostName} :: %level :: %message %newlineLogger: %logger%newlineThread: %thread%newlineDate: %date%newlineNDC: %property{NDC}%newline%newline / /layout /appender !-- Set root logger level to DEBUG and its only appender to A1 -- root level value=DEBUG / appender-ref ref=RollingFileAppender / /root logger name=MyLogger level value=WARN / appender-ref ref=EventLogAppender / appender-ref ref=SmtpAppender / appender-ref ref=RollingFileAppender / /logger /log4net And in my code I have this: private static ILog _defaultLog; ... _defaultLog = log4net.LogManager.GetLogger(MyLogger); _defaultLog.Error(test); However nothing gets written to event log, file or smtp. While debugging there doesn't seem to be any appenders to
failed to download log4net 1.2.10
Hi, The download link at, http://logging.apache.org/log4net/download.html is still not working (only 4.8MB) and the cvs copy is gone. Anyone know where I can get the log4net 1.2.10 zip file? Rgds. Martin