juergen.ernst | 7 Apr 2010 19:30
Picon
Favicon

Log4net RollingFileAppender stops to roll over


Hello,

I'm using log4net v1.2.10 and encountered the following problem:
I'm using a rolling file appender and everything worked quite fine for a
while. But suddenly (after some weeks) the RollingFileAppender stops to
roll over for no obvious reason (at least I can see no reason) and now I
have a really very big log file.
Can you help me?

The application runs on a Windows 2003 system. Here comes my config file:

++++++++++++++++++++++++++
<?xml version="1.0" encoding="utf-8"?>
<log4net>

      <appender name="RollingLogFileAppender"
      type="log4net.Appender.RollingFileAppender">
      <param name="File" value="C:\\Documents and Settings\\All
      Users\\Application Data\\CWS\\log\\CWSServer.log"/>
      <param name="AppendToFile" value="true"/>
      <param name="MaxSizeRollBackups" value="50"/>
      <param name="RollingStyle" value="Date"/>
      <param name="DatePattern" value="yyyyMMdd"/>
      <param name="StaticLogFileName" value="true"/>
      <layout type="log4net.Layout.PatternLayout">
      <param name="ConversionPattern" value="%d{dd.MM.yyyy HH:mm:ss} [%t]
      %-5p %c{1} - %m%n"/>

</layout>
(Continue reading)

Alasdair Richardson | 7 Apr 2010 20:09

RE: Log4net RollingFileAppender stops to roll over

I am not an expert on log4net .. But the first thing I would check is how many log files you actually have? If = 50
then I would suspect that  MaxsizeRollBackups is not doing what the doc says it should do (ie erasing old
files) after 7 weeks one day. If != 50 then there is some other problem.

-----Original Message-----
From: juergen.ernst <at> pta.de [mailto:juergen.ernst <at> pta.de] 
Sent: 07 April 2010 19:31
To: log4net-user <at> logging.apache.org
Subject: Log4net RollingFileAppender stops to roll over


Hello,

I'm using log4net v1.2.10 and encountered the following problem:
I'm using a rolling file appender and everything worked quite fine for a
while. But suddenly (after some weeks) the RollingFileAppender stops to
roll over for no obvious reason (at least I can see no reason) and now I
have a really very big log file.
Can you help me?

The application runs on a Windows 2003 system. Here comes my config file:

++++++++++++++++++++++++++
<?xml version="1.0" encoding="utf-8"?>
<log4net>

      <appender name="RollingLogFileAppender"
      type="log4net.Appender.RollingFileAppender">
      <param name="File" value="C:\\Documents and Settings\\All
      Users\\Application Data\\CWS\\log\\CWSServer.log"/>
(Continue reading)

juergen.ernst | 8 Apr 2010 00:58
Picon
Favicon

Antwort: RE: Log4net RollingFileAppender stops to roll over

I already erased all old files but no effect.
There must be some other problem...

PTA Programmier-Technische Arbeiten GmbH
Seckenheimer Str. 65-67, 68165 Mannheim
Amtsgericht Mannheim, HRB 1139
USt-IdNr.: DE 143 839 368
Geschäftsführer:
Dipl.-Ing. Peter Fischer
Dr. Harald W. Busch
Dipl.-Kfm. Knut Fischer

**********************************************************************
http://www.pta.de
Mit 1875 Erfahrungsberichten aus 41 Jahren erfolgreicher Projektarbeit!
**********************************************************************

PTA Programmier-Technische Arbeiten GmbH
Seckenheimer Str. 65-67, 68165 Mannheim
Amtsgericht Mannheim, HRB 1139
USt-IdNr.: DE 143 839 368
Geschaeftsfuehrer:
Dipl.-Ing. Peter Fischer
Dr. Harald W. Busch
Dipl.-Kfm. Knut Fischer

juergen.ernst | 8 Apr 2010 14:55
Picon
Favicon

GetLastWriteTime in RollingFileAppender.RollOverIfDateBoundaryCrossing seems to return wrong date

Hello,

it seems that the Method of  System.IO.File GetLastWriteTime sometimes
returns the current time insted of the time the log file or directory was
last written to.
What i've don was this: I activated log4net internal logging and checked
the RollingFileAppender.cs file. It seems that everey time, log4net calls
GetLastWriteTime (in RollingFileAppender.RollOverIfDateBoundaryCrossing,
line 781 it gets the current time. If it then compares this result with the
current time (to decide if a new file should be created) theses times are
the same and therefore no new file is created for that reason.
Is this a known bug? (My system is a Win2003 server.)

Juergen

PTA Programmier-Technische Arbeiten GmbH
Seckenheimer Str. 65-67, 68165 Mannheim
Amtsgericht Mannheim, HRB 1139
USt-IdNr.: DE 143 839 368
Geschäftsführer:
Dipl.-Ing. Peter Fischer
Dr. Harald W. Busch
Dipl.-Kfm. Knut Fischer

**********************************************************************
http://www.pta.de
Mit 1875 Erfahrungsberichten aus 41 Jahren erfolgreicher Projektarbeit!
**********************************************************************

PTA Programmier-Technische Arbeiten GmbH
(Continue reading)

ITemplate | 9 Apr 2010 08:59
Picon
Favicon

Possible to test log4net filters on certain logevent?


Hi,

Is this "old" forum the only for log4net? Anyways - suppose I have a certain
logevent, is it possible to investigate up front IF that particular logevent
would pass all filters? I can't seem to find a Filters collection that I can
use for this?

-- 
Werner
--

-- 
View this message in context: http://old.nabble.com/Possible-to-test-log4net-filters-on-certain-logevent--tp28188373p28188373.html
Sent from the Log4net - Users mailing list archive at Nabble.com.

harry.douglass | 9 Apr 2010 10:42
Picon

Out of the office


I will be out of the office starting  04/08/2010 and will not return until
04/12/2010.

I will respond to your message upon my return.  If you need immediate
assistance, please contact Jim Snyder at (215) 585-6514.  Thank you.

The contents of this email are the property of PNC. If it was not addressed to you, you have no legal right to
read it. If you think you received it in error, please notify the sender. Do not forward or copy without
permission of the sender. This message may contain an advertisement of a product or service and thus may
constitute a commercial electronic mail message under US Law. The postal address for PNC is 249 Fifth
Avenue, Pittsburgh, PA 15222. If you do not wish to receive any additional advertising or promotional
messages from PNC at this e-mail address, click here to unsubscribe.
https://pnc.p.delivery.net/m/u/pnc/uni/p.asp By unsubscribing to this message, you will be
unsubscribed from all advertising or promotional messages from PNC. Removing your e-mail address from
this mailing 
 list will not affect your subscription to alerts, e-newsletters or account servicing e-mails.

VJKishan | 12 Apr 2010 14:33

Custom Event Log source


Hi,

I need the messages to be logged in eventlog on a custom event log source [
My Application name ]. How to go about this.

if the custom event log source is not there it has to create and log. 
--

-- 
View this message in context: http://old.nabble.com/Custom-Event-Log-source-tp28217058p28217058.html
Sent from the Log4net - Users mailing list archive at Nabble.com.

Tomas Ramirez | 12 Apr 2010 18:45
Favicon

RE: Custom Event Log source

I think you have to create the event log yourself, outside of log4net.
http://msdn.microsoft.com/en-us/library/49dwckkz.aspx 

- Tomas

-----Original Message-----
From: VJKishan [mailto:vijaykishan.sundar <at> wipro.com] 
Sent: Monday, April 12, 2010 6:33 AM
To: log4net-user <at> logging.apache.org
Subject: Custom Event Log source

Hi,

I need the messages to be logged in eventlog on a custom event log source [ My Application name ]. How to go
about this.

if the custom event log source is not there it has to create and log. 
--
View this message in context: http://old.nabble.com/Custom-Event-Log-source-tp28217058p28217058.html
Sent from the Log4net - Users mailing list archive at Nabble.com.

ITemplate | 13 Apr 2010 15:18
Picon
Favicon

Re: Possible to test log4net filters on certain logevent?


Noone knows? Perhaps I could rephrase: I need a programmatic way to determine
if a certain logentry would be filtered or not.

Example: I have the following logentry: 
logger.Warn("This might be logged but I dont know. I want to test it in
code.");

Now I want to find out - at runtime - if that specific line in my code will
produce a log. Some programmatic way to test one or all configured filters
against the data in my log-line (Logger, Level, text etc). 

Hope my meaning here is more clearer?

Thanks.

ITemplate wrote:
> 
> Hi,
> 
> Is this "old" forum the only for log4net? Anyways - suppose I have a
> certain logevent, is it possible to investigate up front IF that
> particular logevent would pass all filters? I can't seem to find a Filters
> collection that I can use for this?
> 
> -- 
> Werner
> 

--

-- 
(Continue reading)

Loren Keagle | 13 Apr 2010 19:44

Re: Possible to test log4net filters on certain logevent?

I don't think that this is possible without some dangerous coding.  Looking at the source code, there are no methods on any appenders to test the level/filter chain in advance.  Given that your log4net config could contain dozens of appenders, each with their own set of filters, you could not make a single call to determine if an event would be filtered from all of them.  Perhaps if you provided a little bit of context, someone here might be able to offer an alternative approach?

If you really must have a programmatic way of doing this, you would have to gain access to all of your appenders, iterate through them, casting each to AppenderSkeleton (assuming the appender derives from this helper class!!!), test the log level of each, then iterate through all of the filters in the FilterHead linked list property.  AppenderSkeleton has a protected method called FilterEvent that does all of this, but you cannot access it.  It would probably have solved your problem if this method was part of the IAppender interface, but it's currently not accessible.

So I suppose it is possible, but you're going to end up duplicating all of the logic that is already in AppenderSkeleton, which means you will be executing code twice.  If you have multiple appenders, you will have to check each appender separately.

~Loren Keagle


On 4/13/2010 6:18 AM, ITemplate wrote:
Noone knows? Perhaps I could rephrase: I need a programmatic way to determine if a certain logentry would be filtered or not. Example: I have the following logentry: logger.Warn("This might be logged but I dont know. I want to test it in code."); Now I want to find out - at runtime - if that specific line in my code will produce a log. Some programmatic way to test one or all configured filters against the data in my log-line (Logger, Level, text etc). Hope my meaning here is more clearer? Thanks. ITemplate wrote:
Hi, Is this "old" forum the only for log4net? Anyways - suppose I have a certain logevent, is it possible to investigate up front IF that particular logevent would pass all filters? I can't seem to find a Filters collection that I can use for this? -- -- Werner
No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.801 / Virus Database: 271.1.1/2807 - Release Date: 04/12/10 11:32:00


Gmane