Getting rid of derby.log

前端 未结 8 842
萌比男神i
萌比男神i 2020-12-23 12:19

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

8条回答
  •  被撕碎了的回忆
    2020-12-23 12:46

    You can get rid of derby.log file by creating the following class

    public class DerbyUtil {
        public static final OutputStream DEV_NULL = new OutputStream() {
            public void write(int b) {}
        };
    }
    

    and setting the JVM system property derby.stream.error.field, for example, using the following JVM command-line argument:

    -Dderby.stream.error.field=DerbyUtil.DEV_NULL
    

    Credit to whom it is due.

提交回复
热议问题