if do not use the config file, how to stop the log file, emalog, by coding?

if do not use the config file, how to stop the log file, emalog, by coding?

Best Answer

  • Jirapongse
    Jirapongse admin
    Answer ✓

    @kage.wu

    You can programmatically create configurations. For example, please refer to the 421__MarketPrice__ProgrammaticConfig example.

    To disable EMA log file, you need to set LoggerType to 1 (LoggerType::StdoutEnum) and LoggerSeverity to 4 (Severity::NoLogMsgEnum).

        innerMap.addKeyAscii( "Logger_1", MapEntry::AddEnum,
            ElementList()
            .addEnum( "LoggerType", 1 )
            .addAscii( "FileName", "logFile" )
            .addEnum( "LoggerSeverity", 4 ).complete() ).complete();

    However, the configurations can't be changed after they are used to create an OMMConsumer.

    OmmConsumer consumer( OmmConsumerConfig().config( configMap ) );    

Answers

  • Hi @kage.wu,

    The recommended way to do this is by using an EMA Configuration file. Please see this question for more details.

    I don't believe there is a way to do this entirely within code. Please refer to a similar question you asked on another thread. .

    thanks.

  • I haven't used any config in my app, but I still have log files as emaLog_*. How can I put into my source codes to stop the log files?

  • Hi @kage.wu,

    Please see my answer below. I'm recommending to use a config file only to to disable these log files. The answer also states that you can't put it into your source code.

  • that's ridiculous. so how to use the config file in the coding? can you provide to me? it will save me time

  • Hi @kage.wu,

    EMA doesn't provide the ability to override all configuration with source code unfortunately which is why you will need to define an EMAConfig.xml file for your application. You don't have to code this in, but instead define the file, configure it and EMA will recognize it. Refer to the documentation for details.