3

Atomikos is quite verbose when used. There seems to be lots of INFO messages (mostly irrelevant for me) that the transaction manager writes out to the console. The setting in the transaction.properties that is suppose to control the level of messaging com.atomikos.icatch.console_log_level does not seem to have any effect, since even when set to WARN (or ERROR) the INFO messages are still logged. Also the log4j settings for com.atomikos and atomikos seem to be ignored. Does anyone manage to turn off the INFO logs on the console with Atomikos?. How? Thanks

Peter

Petre Maierean
  • 914
  • 3
  • 14
  • 21

4 Answers4

1

I am using Atomikos 3.8 for testing and tried all solutions listed here (4 July 2012) and none worked.

So I created the following class MockAtomikosLogger and called the configure method in my test set up.

Test Setup code fragment:

    MockAtomikosLogger.configure();

The mock logger follows:

package com.atomikos.logging;

import com.atomikos.logging.Logger;

public class MockAtomikosLogger implements Logger {

    org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(getClass());

    public static void configure() {
        com.atomikos.logging.LoggerFactory.setLoggerFactoryDelegate(
                new LoggerFactoryDelegate() {

                    @Override
                    public Logger createLogger(Class<?> clazz) {
                        return new MockAtomikosLogger();
                    }
                });
    }//end configure

    @Override
    public void logWarning(String message) {
        logger.warn(message);
    }

    @Override
    public void logInfo(String message) {
    }

    @Override
    public void logDebug(String message) {
    }

    @Override
    public void logWarning(String message, Throwable error) {
        logger.warn(message, error);
    }

    @Override
    public void logInfo(String message, Throwable error) {
    }

    @Override
    public void logDebug(String message, Throwable error) {
    }

    @Override
    public boolean isDebugEnabled() {
        return false;
    }

    @Override
    public boolean isInfoEnabled() {
        return false;
    }   
}
cary
  • 11
  • 1
0

I had similar issues and managed to resolve them as described in these posts to the Atomikos forum (1), here is a summary of the solution:

In my classpath I have:
slf4j-api-1.6.4.jar
slf4j-log4j12-1.6.4.jar
log4j-1.2.16.jar
and I don't have other slf4j* jar files in the classpath (this is important).

In my log4j.xml file I have added:

<logger name="com.atomikos">
    <level value="error" />
</logger>

Please notice that I used "com.atomikos" and not "atomikos" (as the latter doesn't work for me). And now the other important trick that made the whole thing work: make sure that the property: com.atomikos.icatch.output_dir

is removed/commented out in jta.properties (or transactions.properties)

I hope it helps.

(1): http://fogbugz.atomikos.com/default.asp?community.6.2809.2

  • 1
    Answers which just contain links are [considered bad practice](http://meta.stackexchange.com/questions/8231/are-answers-that-just-contain-links-elsewhere-really-good-answers). Please summarize the content here (don't copy/paste) so the answer can stand on its own. If you don't you run the risk of your answer being removed, especially if the link ever dies. – Martijn Pieters May 31 '12 at 13:54
0

I've figured out a way to do that. It is actually very simple since Atomikos uses a centralize class to do the logging called com.atomikos.icatch.system.Configuration. Logging is actually performed with implementations of com.atomikos.diagnostics.Console so all I had to do is to un-register all default consoles and register my own implementation that's based on commons logging

Petre Maierean
  • 914
  • 3
  • 14
  • 21
0

Your fix could work, but the easier thing would be to configure SLF4J/Log4J to NOT log INFO level comments for com.atomikos.*

HTH

Guy Pardon
  • 484
  • 2
  • 8
  • 1
    I've tried that before without result. Take a look on their sources (they do a System.out to the console by default) – Petre Maierean Apr 29 '10 at 21:43
  • @peter They is He, Guy is the Co-founder of Atomikos :) – Ittai Nov 11 '10 at 21:29
  • 2
    Just in case anyone stops by and doesn't understand why the above solution does not work- It's because it's not com.atomikos.* BUT just "atomikos" (without the quotes of course) This is true for Atomikos 3.70 – Ittai Dec 27 '10 at 16:08
  • I changed my log4j.xml to add a name of "atomikos", with level value "off", and it made no difference. It still creates the tm.out, tmlog0.log, and an IP.tm0.epoch file. I'm using Atomikos 3.7.0. – David M. Karr Oct 21 '11 at 17:42
  • @David that's because those are not really informative log files but files crucial to Atomikos functionality. The logging that is being spoken of here is informative logging which can be switched off by using log4j.logger.atomikos=ERROR – Nicolas Mommaerts Mar 02 '12 at 07:55