I've updated my github with an implementation that works when the for my circumstance (compression & no file in appender).
I don't think rollover() should be invoked within the close() method. You rather want to close the file and than compress it.
The compression goes something like:
if (compressionMode == CompressionMode.NONE) {
// nothing to do?
} else {
if (getParentsRawFileProperty() == null) {
asyncCompress(elapsedPeriodsFileName, elapsedPeriodsFileName,
elpasedPeriodStem);
} else {
renamedRawAndAsyncCompress(elapsedPeriodsFileName,
elpasedPeriodStem);
}
}
See the rollover() method in TimeBasedRollingPolicy. I'll have another look at all this tomorrow.
Cheers,
--
Ceki
http://twitter.com/#!/ceki
On 05/11/2011 12:30 AM, TJ Rothwell wrote:
Ceki,* CloseTBRP.java
So I gave it a shot.
<https://github.com/trothwell/logback-test/blob/master/src/main/java/org/trothwell/lbtest/CloseTBRP.java>
* TestCloseTBRP.java
<https://github.com/trothwell/logback-test/blob/master/src/test/java/org/trothwell/lbtest/TestCloseTBRP.java>* I'm unable to delete files after stopping LoggerContext.
I'm running into a few problems if you have some time to take a look:
* Output file count is off (SiftingAppender or RollingFileAppender* NullPointerException occurs when stopping LoggerContext with
doesn't create both output files)1. Create a normal TimeBasedRollingPolicy configured for compression
CloseTBRP in use
I have two scenarios.
2. Create the new auto-close CloseTBRP that will do the same.
that will create 2 output files.1. Create new LoggerContext
For both configurations this is the steps: (or look at unit test)
2. Configure LoggerContext
3. Submit a log event
4. Set MDC property for discriminator
5. Submit a log event
6. Stop LoggerContext
7. Check log file counts
1. for TBRP, 2 text files
2. for CloseTBRP, 2 zip files
Have a great weekend,
-- TJ
_______________________________________________
Logback-user mailing list
Logback-user@qos.ch
http://mailman.qos.ch/mailman/listinfo/logback-user