Getting rid of derby.log

前端 未结 8 786
萌比男神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:47

    You can also just set derby home to target/derby or targetvia:

    System.setProperty("derby.system.home", new File("target/derby").getAbsolutePath());
    

    and then use the JDBC URL jdbc:derby:unittest-db;create=true. Then derby.log appears in the right folder.

    0 讨论(0)
  • 2020-12-23 12:49

    I have came up with another solution. Try this out; it worked for me. What I am doing here is I have changed the System.stream.error.file path and set it to one of the properties present under my property file. Just adding the below given code to your applicationContext.xml file will work.

    <bean id="setDerbyLog" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
      <property name="targetClass"><value>java.lang.System</value></property>
      <property name="targetMethod"><value>setProperty</value></property>
      <property name="arguments">
        <list>
          <value>derby.stream.error.file</value>
          <value>${derby.stream.error.file}</value>
        </list>
      </property>
    </bean>
    
    0 讨论(0)
提交回复
热议问题