logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Park <simon_park_m...@yahoo.co.uk>
Subject Re: Custom Appender works fine with rootlogger, but not when logger specified
Date Thu, 19 Mar 2009 14:06:56 GMT
Hi,

Take a look at the http://www.simonsite.org.uk/javadoc/org/apache/log4j/appender/TimeAndSizeRollingAppender.html.
 Source is available in the JAR at http://www.simonsite.org.uk/resources/lib/log4j-rolling-appender.jar.
 This appender does a similar thing to your custom appender by the sounds of it.

Simon




________________________________
From: Guy <guy.van.tilborgh@gmail.com>
To: log4j-user@logging.apache.org
Sent: Thursday, 19 March, 2009 9:48:51
Subject: Custom Appender works fine with rootlogger, but not when logger  specified

Hi,

I have written a custom appender that adds file rotation and zipping
of the rotated files. Some other custom functionality is added. What I
do is: when a file has reached a certain size, I close the file,
rename it and compress it. After the rename, I reset the file. The
renaming of the file is where it all goes wrong.


Everything works fine if I stick to using the rootLogger:

<Defining of our custom appender>

log4j.rootLogger=INFO, ddm

#THIS WORKS FINE
#log4j.logger.mylogger=INFO


#THIS DOES NOT WORK FINE. Note That we do not even write to this logger (class)
log4j.logger.be.package=INFO, mylogger


SO for some reason, using the line "log4j.logger.be.package=INFO,
mylogger" creates an object that prevents the rename from taking
place.

I have looked at the RollingFileAppender about closing the
file/writing to the stream, but as far as I can see, I do the same. I
could also rewrite my custom appender starting from the
RollingFileAppender, but that is something I want to prevent

Any help would be apreciated

Guy

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


      
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message