question

Upvotes
Accepted
4 2 0 4

EMA C++ MRN Consumer Client - how to prevent emaLog_.log file creation

We are seeing log files named "emaLog_<sequence number>.log" being produced as part of running a MRN Consumer Client app.

Is there a way of turning the creation of these log files off or controlling the number being created with automatic deletion?

Thanks

Dave

elektronrefinitiv-realtimeelektron-sdkrrtema-apielektron-message-apilogging
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

10 Answers

Upvotes
Accepted
7.6k 15 6 9

@Dave Streeter

According to Ema Configuration Guide EMACPP_ConfigGuide.pdf, default LoggerType is File. If you don't need logger message in File, you have to copy EmaConfig.xml running directory. And then modify LoggerType type in section Logger_1 configuration to Stdout as follow

<Logger>
	<Name value="Logger_1"/>
	<LoggerType value="LoggerType::Stdout"/>
	<LoggerSeverity value="LoggerSeverity::Success"/>
</Logger

Ema internal will read Logger configuration from EmaConfig.xml and use the LoggerType value from the file.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
4 2 0 4

@moragodkrit

Thanks for the help.

Can you tell me which folder is the running directory as I cannot find the EMA app/exe file? Is it where the emaLog files are created?

Thanks

Dave

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

If you click and run MRNConsumer.exe.from folder such as "step5 - Download & decode Machine Readable News\WIN_64_VS120\Debug_MDd", it should be the same folder as your binary.

Upvotes
4 2 0 4

@moragodkrit

I am still getting emaLog files created such as:

emaLog_3646.log

loggerMsg
    TimeStamp: 12:02:52.035
    ClientName: ChannelCallbackClient
    Severity: Success
    Text:    Received ChannelUp event on channel Channel
        Instance Name EmaConsumer_1
        Connected component version: ezd1.2.1.L1.linux.rrg 64-bit
loggerMsgEnd

Any ideas?

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

I think I have to set NoLogMsg, I'll give it a go!

Upvotes
4 2 0 4

@moragodkrit

Here is the EmaConfig.xml I am using:

<Logger>
        <Name value="Logger_1"/>
        <LoggerType value="LoggerType::Stdout"/>
        <LoggerSeverity value="LoggerSeverity::NoLogMsg"/>
</Logger>

Even with the EmaConfig.xml file in the running directory and the folder where the emaLogs are created I am still getting emaLogs created such as:

loggerMsg
    TimeStamp: 14:21:37.219
    ClientName: ChannelCallbackClient
    Severity: Success
    Text:    Received ChannelUp event on channel Channel
        Instance Name EmaConsumer_1
        Connected component version: ezd1.2.1.L1.linux.rrg 64-bit
loggerMsgEnd

Do I need to restart EZD or something else?

Any ideas?

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
4 2 0 4

@moragodkrit

Since I have 2 client processes I thought I would need the following EmaConfig.xml file:

<Logger>
        <Name value="Logger_1"/>
        <LoggerType value="LoggerType::Stdout"/>
        <LoggerSeverity value="LoggerSeverity::NoLogMsg"/>
</Logger>
<Logger>
        <Name value="Logger_2"/>
        <LoggerType value="LoggerType::Stdout"/>
        <LoggerSeverity value="LoggerSeverity::NoLogMsg"/>
</Logger>

But I now get the 2 log files, log file 1:

loggerMsg
    TimeStamp: 15:36:56.076
    ClientName: EmaConfig
    Severity: Error
    Text:    extractXMLdataFromCharBuffer: xmlReadMemory failed while processing EmaConfig.xml
loggerMsgEnd
loggerMsg
    TimeStamp: 15:36:56.076
    ClientName: EmaConfig
    Severity: Error
    Text:    failed to extract configuration from [EmaConfig.xml]
loggerMsgEnd
loggerMsg
    TimeStamp: 15:36:56.204
    ClientName: ChannelCallbackClient
    Severity: Success
    Text:    Received ChannelUp event on channel Channel
        Instance Name EmaConsumer_1
        Connected component version: ezd1.2.1.L1.linux.rrg 64-bit
loggerMsgEnd

log file 2:

loggerMsg
    TimeStamp: 15:36:56.073
    ClientName: EmaConfig
    Severity: Error
    Text:    extractXMLdataFromCharBuffer: xmlReadMemory failed while processing EmaConfig.xml
loggerMsgEnd
loggerMsg
    TimeStamp: 15:36:56.073
    ClientName: EmaConfig
    Severity: Error
    Text:    failed to extract configuration from [EmaConfig.xml]
loggerMsgEnd
loggerMsg
    TimeStamp: 15:36:56.204
    ClientName: ChannelCallbackClient
    Severity: Success
    Text:    Received ChannelUp event on channel Channel
        Instance Name EmaConsumer_1
        Connected component version: ezd1.2.1.L1.linux.rrg 64-bit
loggerMsgEnd

Any ideas?

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

It seems like EMA is having issues reading the XML configuration file - extractXMLdataFromCharBuffer.

Can you verify that XML is well formed and there are no extra characters in the file. Also, if the file is UTF-8, change the encoding to ANSI and try again.

Upvotes
13k 32 12 18

Hi @Dave Streeter. You don't need to restart the EZD; EMA configuration is picked up when the api application starts.

I used following configuration and it resulted in a blank log file:

<Logger>
    <Name value="Logger_1"/>
    <LoggerType value="LoggerType::File"/>
    <LoggerSeverity value="LoggerSeverity::NoLogMsg"/>
</Logger>

Make sure that the consumer instance is using this logger in the configuration. My application uses Consumer1, which looks like:

<Consumer>
    <Name value="Consumer_1"/>
    <Logger value="Logger_1"/>
    .
    .
</Consumer>

A DefaultConsumer is used if no consumer name is specified.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

So does a file get created even if NoLogMsg is specified?

Is there no way to prevent the file being created at all?

Thanks

Dave

In this example the file is getting created since LoggerType:File is specified. Changing it to Stdout, suppresses the file creation.

Upvotes
7.6k 15 6 9

@Dave Streeter

As Gurpreet said, the problem is EMA unable to load the EmaConfig.xml file. The following message confirmed the assumption. Thus it uses default configuration instead and that why it generate ema log in your running directory.

loggerMsg
    TimeStamp: 15:36:56.076
    ClientName: EmaConfig
    Severity: Error
    Text:    extractXMLdataFromCharBuffer: xmlReadMemory failed while processing EmaConfig.xml
loggerMsgEnd
loggerMsg
    TimeStamp: 15:36:56.076
    ClientName: EmaConfig
    Severity: Error
    Text:    failed to extract configuration from [EmaConfig.xml]
loggerMsgEnd

The problem is not relate with running directory. It looks like the XML file contains invalid XML tag/data inside, you may replaced the xml file with original one. If you still found the issue please attached your xml file in the post.

Also original code for MRNConsumer example just hard codes host and port in EMA codes so that it just read default Logger_1 from the configuration file. I think you don't need multple logger section in the configuration file.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
4 2 0 4

@moragodkrit

I am getting somewhere now.

If I use the following EmaConfig.xml I get log files but no errors in them:

<Logger>
        <Name value="Logger_1"/>
        <LoggerType value="LoggerType::Stdout"/>
        <LoggerSeverity value="LoggerSeverity::NoLogMsg"/>
</Logger>

Gives emaLog:

loggerMsg
    TimeStamp: 08:03:24.417
    ClientName: ChannelCallbackClient
    Severity: Success
    Text:    Received ChannelUp event on channel Channel
        Instance Name EmaConsumer_1
        Connected component version: ezd1.2.1.L1.linux.rrg 64-bit
loggerMsgEnd

However, if I use the following EmaConfig.xml then I get errors:

<Logger>
        <Name value="Logger_1"/>
        <LoggerType value="LoggerType::Stdout"/>
        <LoggerSeverity value="LoggerSeverity::NoLogMsg"/>
</Logger>
<Consumer>
    <Name value="EmaConsumer_1"/>
    <Logger value="Logger_1"/>
</Consumer>

Gives emaLog:

loggerMsg
    TimeStamp: 08:19:12.154
    ClientName: EmaConfig
    Severity: Error
    Text:    extractXMLdataFromCharBuffer: xmlReadMemory failed while processing EmaConfig.xml
loggerMsgEnd
loggerMsg
    TimeStamp: 08:19:12.154
    ClientName: EmaConfig
    Severity: Error
    Text:    failed to extract configuration from [EmaConfig.xml]
loggerMsgEnd
loggerMsg
    TimeStamp: 08:19:12.219
    ClientName: ChannelCallbackClient
    Severity: Success
    Text:    Received ChannelUp event on channel Channel
        Instance Name EmaConsumer_1
        Connected component version: ezd1.2.1.L1.linux.rrg 64-bit
loggerMsgEnd

Any ideas?

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
7.6k 15 6 9

@Dave Streeter

Looks like you have modified original configuration and change consumer name from Consumer_1 to EmaConsumer_1.
Have you changed DefaultConsumer in the xml to "EmaConsumer_1"?

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

I have just checked the code and I do not call consumerName() so I don't know where "EmaConsumer_1" is coming from.

I could try specifying EmaConsumer_1 to see if that works but the following xml failes as above:

<Logger>
        <Name value="Logger_1"/>
        <LoggerType value="LoggerType::Stdout"/>
        <LoggerSeverity value="LoggerSeverity::NoLogMsg"/>
</Logger>
<Consumer>
    <Name value="EmaConsumer_1"/>
    <Logger value="Logger_1"/>
</Consumer>
Upvotes
4 2 0 4

I think I have solved the issue with the following EmaConfig.xml:

<?xml version="1.0" encoding="UTF-8"?>
<EmaConfig>
<ConsumerGroup>
    <DefaultConsumer value="Consumer_1"/>
    <ConsumerList>
        <Consumer>
            <Name value="Consumer_1"/>
            <Channel value="Channel_1"/>
            <Logger value="Logger_1"/>
        </Consumer>
    </ConsumerList>
</ConsumerGroup>
<LoggerGroup>
    <LoggerList>
        <Logger>
            <Name value="Logger_1"/>
            <LoggerType value="LoggerType::Stdout"/>
            <LoggerSeverity value="LoggerSeverity::NoLogMsg"/>
        </Logger>
    </LoggerList>
</LoggerGroup>
</EmaConfig>
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea