prevent trying to load EmaConfig.xml

Is it possible to prevent totally EMA to try reading the configuration file EmaConfig.xml completely ?

I am specifying the configuration from code using EmaFactory.createOmmConsumerConfig() and adding my own parameters.

However, the following are still showing in the logs, and they could be misinterpreted:

2017-01-16 11:11:48.422 INFO 33216 --- [ restartedMain] c.t.ema.access.OmmConsumerImpl : loggerMsg ClientName: EmaConfig Severity: Info Text: reading configuration file [EmaConfig.xml] from [D:\src\makoco] loggerMsgEnd

2017-01-16 11:11:48.422 ERROR 33216 --- [ restartedMain] c.t.ema.access.OmmConsumerImpl : loggerMsg ClientName: EmaConfig Severity: Error Text: Cannot locate configuration source EmaConfig.xml loggerMsgEnd

Best Answer

  • wasin.w
    wasin.w admin
    Answer ✓

    Hi @GAUTHIER.ROEBROECK

    Basically, the EMA Java is hard coded to look for the EMAConfig.xml file by default in the EmaConfigImpl.readConfiguration() function. This function is called every time the application calls the EmaFactory.createOmmConsumerConfig(); statement.

    The source code is EmaConfigImpl.readConfiguration() in the <Elektron SDK java package>\Ema\Src\main\java\impl\com\thomsonreuters\ema\access\ folder as shown below:

    image

    You can modify the source code above to change the behavior, but I strongly suggest you test the application after code changed to verify if there are any unexpected errors.

Answers

  • Hi @GAUTHIER.ROEBROECK

    As indicated by Wasin, the current implementation of the libraries will always search for the EmaConfig.xml and log details if not found. If there is a concern regarding the misinterpretation of this log message, you do have the option to suppress the log details. Ema Java utilizes the Logger class so you can create your own log handler and intercept this message.

  • That's a shame that this configuration loading is hard coded.

  • Hi,

    A change to config file loading in EMA Java would be a useful addition to EMA. If this change was made as a pull request via GitHub we would certainly considering incorporating that into the EMA trunk for future releases.

    Thanks

    Iain

  • Both EMAJ and EMA C++ will always attempt to load the config
    file, however a config file is not required for either of them. The issue
    you are encountering with EMAJ is that the logging level for the config file
    messages is set to INFO, which ends up being displayed when running with
    default settings. In EMA C++, these are set to a lower log level so they
    are not output at the default logging level. We plan to change the log
    level in EMAJ to match how EMA C++ was set. This should result in the
    config related log messages you see going away unless you switch the log level
    from the default (INFO) to something less granular that would again include them.

    For a quick workaround, and you don’t want to see the message, you
    can set logger level to higher level, see the below (assume you are using java.util.logging)

    -Djava.util.logging.config.file=pathToLoggingConfig/logging.properties

    Inside this logger configuration file, you can set logging level
    to Warning to override the default.

    java.util.logging.ConsoleHandler.level=WARNING

    Hope this helps!