db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bergquist, Brett" <BBergqu...@canoga.com>
Subject I implemented a rolling "derby.log" (DERBY-6350)
Date Thu, 19 Sep 2013 19:55:23 GMT
https://issues.apache.org/jira/browse/DERBY-6350

I implemented this as part of the Derby core engine.  I put my classes in:

java/engine/org/apache/derby/impl/services/stream/RollingFileStream.java

java/engine/org/apache/derby/impl/services/stream/RollingFileStreamProvider.java

As there really was not any other good place that I could find this package is also used for
the basic error stream handling.

Once this is incorporated and derby.jar  built, it can be used by simply adding:

derby.stream.error.method=org.apache.derby.impl.services.stream.RollingFileStreamProvider.getOutputStream
derby.stream.error.rollingfile.pattern=%d/derby-%g.log
derby.stream.error.rollingfile.limit=2048000
derby.stream.error.rollingfile.count=5

To "derby.properties".  In this example, the rolling log files will appear in the DERBY_HOME
directory and have the names derby-0.log, derby-1.log, derby-2.log, derby-3.log, derby-4.log
(maximum count of 5 files) and will have a maximum size of 2048000 bytes each.

Note that this just provides the rolling error stream and the utility class configure and
return the stream.  It uses the "derby.stream.error.method" that exists already to hook into
the logging.

If someone could review this patch it would be much appreciated.   I know that unit tests
need to be created to support this feature but I have not written any up until now.  So if
someone could give me some guidance on doing so, again, it would be much appreciated.

It would be great to see this functionality become a standard part of Derby as I know there
are others out there that want this:

http://stackoverflow.com/questions/1599043/limit-derby-log-file-size
http://apache-database.10148.n7.nabble.com/Derby-housekeep-function-for-derby-log-td132438.html



Mime
View raw message