如何移动Atomikos的tm.out和* .epoch文件的位置? [英] How to move location of Atomikos's tm.out and *.epoch files?

查看:1416
本文介绍了如何移动Atomikos的tm.out和* .epoch文件的位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行一个使用Atomikos的J2SE应用程序,它将许多日志文件转储到当前目录。我想将这些文件的位置移动到/ tmp,但我找不到一个配置属性,我可以从我的Spring XML配置文件中设置。

I'm running a J2SE application that uses Atomikos which dumps it's numerous log files to the current directory. I'd like to move the location of these files to "/tmp", but I cannot locate a configuration property that I can set from within my Spring XML config file.

Atomikos文档引用了一个属性:

The Atomikos documentation references a property:

com.atomikos.icatch.output_dir

这看起来正是我需要的,但是如何从Spring设置它没有jta.properties文件?这是我的事务管理器config:

Which seems exactly what I need, but how to set from Spring it without a jta.properties file? Here is my transaction manager config:

<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
    <property name="transactionManager" ref="atomikosTransactionManager" />
    <property name="userTransaction" ref="atomikosUserTransaction" />
</bean>

<bean id="atomikosTransactionManager" class="com.atomikos.icatch.jta.UserTransactionManager"
    init-method="init" destroy-method="close">
    <!-- When close is called, should we force transactions to terminate? -->
    <property name="forceShutdown" value="false" />
</bean>

<bean id="atomikosUserTransaction" class="com.atomikos.icatch.jta.UserTransactionImp">
    <!-- Number of seconds before transaction timesout. -->
    <property name="transactionTimeout" value="30" />
</bean>


推荐答案

有问题的属性必须在单例实例transactionService - 通常由用户事务管理器按需创建的对象:

The property in question must be set on the singleton instance of the transactionService -- an object that is normally created on-demand by the user transaction manager:

<bean id="userTransactionService" class="com.atomikos.icatch.config.UserTransactionServiceImp"
    init-method="init" destroy-method="shutdownForce">
    <constructor-arg>
        <!-- IMPORTANT: specify all Atomikos properties here -->
        <props>
            <prop key="com.atomikos.icatch.service">com.atomikos.icatch.standalone.UserTransactionServiceFactory</prop>
            <prop key="com.atomikos.icatch.output_dir">target/</prop>
            <prop key="com.atomikos.icatch.log_base_dir">target/</prop>
        </props>
    </constructor-arg>
</bean>

现在该属性已设置。但为了确保您没有两个事务服务运行,您还必须修改用户事务管理器bean,如下所示:

Now the property is set. But in order to ensure you don't have two transaction services running you must also modify the user transaction manager bean as follows:

<bean id="atomikosTransactionManager" class="com.atomikos.icatch.jta.UserTransactionManager"
    init-method="init" destroy-method="close" depends-on="userTransactionService">
    <!-- When close is called, should we force transactions to terminate? -->
    <property name="forceShutdown" value="false" />
    <!-- Do not create a transaction service as we have specified the bean in this file -->
    <property name="startupTransactionService" value="false" />
</bean>

这篇关于如何移动Atomikos的tm.out和* .epoch文件的位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆