Search code examples
javajtabitronix

Change BTM tlog file location


We're using org.codehaus.btm:btm:2.1.4 for our tests and we're seeing these files appear in our maven module directory (which is the working directory):

  • btm1.tlog
  • btm2.tlog

I'd like them to be created in another directory, for example in target/btmlogs/. How can I do configure BTM to do that?


Solution

  • You will have to configure the TransactionManager. Relevant part of the configuration

    Do it in a file called src/main/resources/bitronix-default-config.properties. Something like this:

    # 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