更改 BTM tlog 文件位置

Change BTM tlog file location

我们正在使用 org.codehaus.btm:btm:2.1.4 进行测试,我们看到这些文件出现在我们的 Maven 模块目录(工作目录)中:

我希望它们在另一个目录中创建,例如在 target/btmlogs/ 中。我怎样才能配置 BTM 来做到这一点?

您将必须配置 TransactionManager。 Relevant part of the configuration

在名为 src/main/resources/bitronix-default-config.properties 的文件中执行此操作。像这样:

# Avoid warnings in test log
bitronix.tm.serverId=foo-bar
# Disable tlog files
bitronix.tm.journal=null
# In case the journal is enabled locally, avoid that the btm1.tlog and btm2.tlog files are created in the module's directory
# causing gitignore, mvn clean and IDE indexing issues
bitronix.tm.journal.disk.logPart1Filename=target/btm/btm1.tlog
bitronix.tm.journal.disk.logPart2Filename=target/btm/btm2.tlog