Re: Deleting old logs

2009-06-18 Thread M.Suarez

I have just checked and this is what happened:
log4net:ERROR XmlHierarchyConfigurator: Cannot find Property [RollingMode]
to se
t object on [log4net.Appender.RollingFileAppender]


Ron Grabowski wrote:
 
 
 What happens when you add RollingMode value=Size /?
 
 http://logging.apache.org/log4net/release/config-examples.html
 
 
 
 - Original Message 
 From: M.Suarez moc...@gmail.com
 To: log4net-user@logging.apache.org
 Sent: Monday, June 15, 2009 5:21:24 PM
 Subject: Deleting old logs
 
 
 Hi,
 
 I am trying to just have the latest 2 log files of my application, thus I
 have configured the log4net as follows:
 
 log4net
 appender name=RollingFile
 type=log4net.Appender.RollingFileAppender
   file value=d:\netapps\logfiles\MyApp.log /
   appendToFile value=true /
 MaximumFileSize value=100KB/
 MaxSizeRollBackups value=2 /
   lockingModel type=log4net.Appender.FileAppender+MinimalLock /
 
   layout type=log4net.Layout.PatternLayout
 conversionPattern value=%date [%thread] %-5level %logger -
 %message%newline /
   /layout
 /appender
 
 !-- Set root logger level to INFO and its only appender to Console
 and
 RollingFile--
 root
   level value=INFO /
   appender-ref ref=RollingFile /
 /root
   /log4net
 
 However, there will be more than then two expected log files, this is
 because:
 The maximum applies to each time based group of files and not the total 
 (http://logging.apache.org/log4net/release/sdk/log4net.Appender.RollingFileAppender.MaxSizeRollBackups.html)
 
 How should I configure log4net then to only store the latest two files?
 Any
 help will be greatly appreciate it.
 
 Regards,
 Monica
 -- 
 View this message in context:
 http://www.nabble.com/Deleting-old-logs-tp24042093p24042093.html
 Sent from the Log4net - Users mailing list archive at Nabble.com.
 
 

-- 
View this message in context: 
http://www.nabble.com/Deleting-old-logs-tp24042093p24099615.html
Sent from the Log4net - Users mailing list archive at Nabble.com.



RE: Deleting old logs

2009-06-18 Thread M.Suarez

I too clear the old log files from my app, but i believe that there must be a
way to configure this, thus the log4net takes care of it, right? or doesn't?



Radovan Raszka wrote:
 
 Deleting old log files is thing I'm interested in too.
 According to doc I think MaxSizeRollBackups has reason only when logs are
 rolled over size (you have more log files per day).
 But it probably doesn't work when log is rolled over date only (one log
 per day only). Is it true or not?
 My appender is configured as follows:
 appender name=RollingFile type=log4net.Appender.RollingFileAppender 
   appendToFile value=true / 
   file value=Log/Service.log / 
   layout type=log4net.Layout.PatternLayout 
  conversionPattern value=%date{HH:mm:ss,fff} %5level [%2thread]
 %message (%logger{1}:%line)%n /
   /layout 
   rollingStyle value=Date / 
   Threshold value=DEBUG / 
 /appender 
 But I don't know how to set it to keep last 10 logs. Now I delete old logs
 in my app - I run clean procedure once a day and delete logs whose last
 modification was done before 10 days...
 Radovan
 
 
 -Původní zpráva-
 Od: Ron Grabowski [mailto:rongrabow...@yahoo.com] 
 Odesláno: 17. června 2009 0:05
 Komu: Log4NET User
 Předmět: Re: Deleting old logs
 
 
 What happens when you add RollingMode value=Size /?
 
 http://logging.apache.org/log4net/release/config-examples.html
 
 
 
 - Original Message 
 From: M.Suarez moc...@gmail.com
 To: log4net-user@logging.apache.org
 Sent: Monday, June 15, 2009 5:21:24 PM
 Subject: Deleting old logs
 
 
 Hi,
 
 I am trying to just have the latest 2 log files of my application, thus I
 have configured the log4net as follows:
 
 log4net
 appender name=RollingFile
 type=log4net.Appender.RollingFileAppender
   file value=d:\netapps\logfiles\MyApp.log /
   appendToFile value=true /
 MaximumFileSize value=100KB/
 MaxSizeRollBackups value=2 /
   lockingModel type=log4net.Appender.FileAppender+MinimalLock /
 
   layout type=log4net.Layout.PatternLayout
 conversionPattern value=%date [%thread] %-5level %logger -
 %message%newline /
   /layout
 /appender
 
 !-- Set root logger level to INFO and its only appender to Console
 and
 RollingFile--
 root
   level value=INFO /
   appender-ref ref=RollingFile /
 /root
   /log4net
 
 However, there will be more than then two expected log files, this is
 because:
 The maximum applies to each time based group of files and not the total 
 (http://logging.apache.org/log4net/release/sdk/log4net.Appender.RollingFileAppender.MaxSizeRollBackups.html)
 
 How should I configure log4net then to only store the latest two files?
 Any help will be greatly appreciate it.
 
 Regards,
 Monica
 --
 View this message in context:
 http://www.nabble.com/Deleting-old-logs-tp24042093p24042093.html
 Sent from the Log4net - Users mailing list archive at Nabble.com.
 
 

-- 
View this message in context: 
http://www.nabble.com/Deleting-old-logs-tp24042093p24099616.html
Sent from the Log4net - Users mailing list archive at Nabble.com.



Re: Deleting old logs

2009-06-18 Thread Ron Grabowski

Hopefully you glanced at the public properties on RollingFileAppender and 
realized that the property is actually called RollingStyle:

 RollingStyle value=Size /



- Original Message 
From: M.Suarez moc...@gmail.com
To: log4net-user@logging.apache.org
Sent: Thursday, June 18, 2009 4:53:45 PM
Subject: Re: Deleting old logs


I have just checked and this is what happened:
log4net:ERROR XmlHierarchyConfigurator: Cannot find Property [RollingMode]
to se
t object on [log4net.Appender.RollingFileAppender]


Ron Grabowski wrote:
 
 
 What happens when you add RollingMode value=Size /?
 
 http://logging.apache.org/log4net/release/config-examples.html
 
 
 
 - Original Message 
 From: M.Suarez moc...@gmail.com
 To: log4net-user@logging.apache.org
 Sent: Monday, June 15, 2009 5:21:24 PM
 Subject: Deleting old logs
 
 
 Hi,
 
 I am trying to just have the latest 2 log files of my application, thus I
 have configured the log4net as follows:
 
 log4net
 appender name=RollingFile
 type=log4net.Appender.RollingFileAppender
   file value=d:\netapps\logfiles\MyApp.log /
   appendToFile value=true /
 MaximumFileSize value=100KB/
 MaxSizeRollBackups value=2 /
   lockingModel type=log4net.Appender.FileAppender+MinimalLock /
 
   layout type=log4net.Layout.PatternLayout
 conversionPattern value=%date [%thread] %-5level %logger -
 %message%newline /
   /layout
 /appender
 
 !-- Set root logger level to INFO and its only appender to Console
 and
 RollingFile--
 root
   level value=INFO /
   appender-ref ref=RollingFile /
 /root
   /log4net
 
 However, there will be more than then two expected log files, this is
 because:
 The maximum applies to each time based group of files and not the total 
 (http://logging.apache.org/log4net/release/sdk/log4net.Appender.RollingFileAppender.MaxSizeRollBackups.html)
 
 How should I configure log4net then to only store the latest two files?
 Any
 help will be greatly appreciate it.
 
 Regards,
 Monica
 -- 
 View this message in context:
 http://www.nabble.com/Deleting-old-logs-tp24042093p24042093.html
 Sent from the Log4net - Users mailing list archive at Nabble.com.
 
 

-- 
View this message in context: 
http://www.nabble.com/Deleting-old-logs-tp24042093p24099615.html
Sent from the Log4net - Users mailing list archive at Nabble.com.


Re: Deleting old logs

2009-06-18 Thread Ron Grabowski

While this might not be the exact answer you were looking for, don't forget 
that sometimes its easier to just write the 3 lines of code yourself for 
deleting old log files and move on to other things:

foreach (string file in Directory.GetFiles(c:\\logs, *.log))
{
if (DateTime.Today.Subtract(File.GetLastWriteTime(file)).Days  10)
{
File.Delete(file);
}
}


- Original Message 
From: M.Suarez moc...@gmail.com
To: log4net-user@logging.apache.org
Sent: Monday, June 15, 2009 5:21:24 PM
Subject: Deleting old logs


Hi,

I am trying to just have the latest 2 log files of my application, thus I
have configured the log4net as follows:

log4net
appender name=RollingFile
type=log4net.Appender.RollingFileAppender
  file value=d:\netapps\logfiles\MyApp.log /
  appendToFile value=true /
MaximumFileSize value=100KB/
MaxSizeRollBackups value=2 /
  lockingModel type=log4net.Appender.FileAppender+MinimalLock /

  layout type=log4net.Layout.PatternLayout
conversionPattern value=%date [%thread] %-5level %logger -
%message%newline /
  /layout
/appender

!-- Set root logger level to INFO and its only appender to Console and
RollingFile--
root
  level value=INFO /
  appender-ref ref=RollingFile /
/root
  /log4net

However, there will be more than then two expected log files, this is
because:
The maximum applies to each time based group of files and not the total 
(http://logging.apache.org/log4net/release/sdk/log4net.Appender.RollingFileAppender.MaxSizeRollBackups.html)

How should I configure log4net then to only store the latest two files? Any
help will be greatly appreciate it.

Regards,
Monica
-- 
View this message in context: 
http://www.nabble.com/Deleting-old-logs-tp24042093p24042093.html
Sent from the Log4net - Users mailing list archive at Nabble.com.


Re: Deleting old logs

2009-06-16 Thread Ron Grabowski

What happens when you add RollingMode value=Size /?

http://logging.apache.org/log4net/release/config-examples.html



- Original Message 
From: M.Suarez moc...@gmail.com
To: log4net-user@logging.apache.org
Sent: Monday, June 15, 2009 5:21:24 PM
Subject: Deleting old logs


Hi,

I am trying to just have the latest 2 log files of my application, thus I
have configured the log4net as follows:

log4net
appender name=RollingFile
type=log4net.Appender.RollingFileAppender
  file value=d:\netapps\logfiles\MyApp.log /
  appendToFile value=true /
MaximumFileSize value=100KB/
MaxSizeRollBackups value=2 /
  lockingModel type=log4net.Appender.FileAppender+MinimalLock /

  layout type=log4net.Layout.PatternLayout
conversionPattern value=%date [%thread] %-5level %logger -
%message%newline /
  /layout
/appender

!-- Set root logger level to INFO and its only appender to Console and
RollingFile--
root
  level value=INFO /
  appender-ref ref=RollingFile /
/root
  /log4net

However, there will be more than then two expected log files, this is
because:
The maximum applies to each time based group of files and not the total 
(http://logging.apache.org/log4net/release/sdk/log4net.Appender.RollingFileAppender.MaxSizeRollBackups.html)

How should I configure log4net then to only store the latest two files? Any
help will be greatly appreciate it.

Regards,
Monica
-- 
View this message in context: 
http://www.nabble.com/Deleting-old-logs-tp24042093p24042093.html
Sent from the Log4net - Users mailing list archive at Nabble.com.


RE: Deleting old logs

2009-06-16 Thread Radovan Raszka
Deleting old log files is thing I'm interested in too.
According to doc I think MaxSizeRollBackups has reason only when logs are 
rolled over size (you have more log files per day).
But it probably doesn't work when log is rolled over date only (one log per day 
only). Is it true or not?
My appender is configured as follows:
appender name=RollingFile type=log4net.Appender.RollingFileAppender 
appendToFile value=true / 
  file value=Log/Service.log / 
  layout type=log4net.Layout.PatternLayout 
 conversionPattern value=%date{HH:mm:ss,fff} %5level [%2thread] 
%message (%logger{1}:%line)%n /
  /layout 
  rollingStyle value=Date / 
  Threshold value=DEBUG / 
/appender 
But I don't know how to set it to keep last 10 logs. Now I delete old logs in 
my app - I run clean procedure once a day and delete logs whose last 
modification was done before 10 days...
Radovan


-Původní zpráva-
Od: Ron Grabowski [mailto:rongrabow...@yahoo.com] 
Odesláno: 17. června 2009 0:05
Komu: Log4NET User
Předmět: Re: Deleting old logs


What happens when you add RollingMode value=Size /?

http://logging.apache.org/log4net/release/config-examples.html



- Original Message 
From: M.Suarez moc...@gmail.com
To: log4net-user@logging.apache.org
Sent: Monday, June 15, 2009 5:21:24 PM
Subject: Deleting old logs


Hi,

I am trying to just have the latest 2 log files of my application, thus I have 
configured the log4net as follows:

log4net
appender name=RollingFile
type=log4net.Appender.RollingFileAppender
  file value=d:\netapps\logfiles\MyApp.log /
  appendToFile value=true /
MaximumFileSize value=100KB/
MaxSizeRollBackups value=2 /
  lockingModel type=log4net.Appender.FileAppender+MinimalLock /

  layout type=log4net.Layout.PatternLayout
conversionPattern value=%date [%thread] %-5level %logger - 
%message%newline /
  /layout
/appender

!-- Set root logger level to INFO and its only appender to Console and
RollingFile--
root
  level value=INFO /
  appender-ref ref=RollingFile /
/root
  /log4net

However, there will be more than then two expected log files, this is
because:
The maximum applies to each time based group of files and not the total 
(http://logging.apache.org/log4net/release/sdk/log4net.Appender.RollingFileAppender.MaxSizeRollBackups.html)

How should I configure log4net then to only store the latest two files? Any 
help will be greatly appreciate it.

Regards,
Monica
--
View this message in context: 
http://www.nabble.com/Deleting-old-logs-tp24042093p24042093.html
Sent from the Log4net - Users mailing list archive at Nabble.com.


Deleting old logs

2009-06-15 Thread M.Suarez

Hi,

I am trying to just have the latest 2 log files of my application, thus I
have configured the log4net as follows:

log4net
appender name=RollingFile
type=log4net.Appender.RollingFileAppender
  file value=d:\netapps\logfiles\MyApp.log /
  appendToFile value=true /
MaximumFileSize value=100KB/
MaxSizeRollBackups value=2 /
  lockingModel type=log4net.Appender.FileAppender+MinimalLock /

  layout type=log4net.Layout.PatternLayout
conversionPattern value=%date [%thread] %-5level %logger -
%message%newline /
  /layout
/appender

!-- Set root logger level to INFO and its only appender to Console and
RollingFile--
root
  level value=INFO /
  appender-ref ref=RollingFile /
/root
  /log4net

However, there will be more than then two expected log files, this is
because:
The maximum applies to each time based group of files and not the total 
(http://logging.apache.org/log4net/release/sdk/log4net.Appender.RollingFileAppender.MaxSizeRollBackups.html)

How should I configure log4net then to only store the latest two files? Any
help will be greatly appreciate it.

Regards,
Monica
-- 
View this message in context: 
http://www.nabble.com/Deleting-old-logs-tp24042093p24042093.html
Sent from the Log4net - Users mailing list archive at Nabble.com.