Getting rid of derby.log

Allan Lykke Christensen picture Allan Lykke Christensen · Jun 17, 2009 · Viewed 25.9k times · Source

I'm using the Apache Derby embedded database for unit testing in a Maven project. Unfortunately whenever I run the test I end up with the derby.log file in the root of the project. The database itself is created in the target directory (jdbc:derby:target/unittest-db;create=true) so that is not a problem. After consulting the reference guide I tried setting the logDevice parameter on the JDBC url (jdbc:derby:target/unittest-db;create=true;logDevice=/mylogs) but that seems to be for a different log, hence derby.log still appears.

Any help is much appreciated.

Answer

Laurent Fournié picture Laurent Fournié · Dec 19, 2009

Derby lets you specify the name of the file to which the error log messages are written using the Java system property derby.stream.error.file. The default value is 'derby.log'.

To get rid of derby.log during the Maven surefire testing phase, I just add the property definition in the plugin configuration as follows:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <configuration>
        <systemProperties>
            <property>
                <name>derby.stream.error.file</name>
                <value>target/derby.log</value>
            </property>
        </systemProperties>
    </configuration>
</plugin>