如何移动 Atomikos 的 tm.out 和 *.epoch 文件的位置?

发布于 2024-09-10 05:05:44 字数 1105 浏览 9 评论 0原文

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

Atomikos 文档引用了一个属性:

com.atomikos.icatch.output_dir

这似乎正是我所需要的,但是如何在没有 jta.properties 文件的情况下从 Spring 设置它?这是我的事务管理器配置:

<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>

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.

The Atomikos documentation references a property:

com.atomikos.icatch.output_dir

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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

分開簡單 2024-09-17 05:05:44

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

<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,如下所示:

<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>

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>

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>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文