Date is not shown in TimeStamp in EMA log message.

manasendu
manasendu Newcomer
edited March 14 in EMA

Hi,

I am trying to configure a Logger programmatically in the Enterprise Message API. But when I am trying to include date in EMA log message
it is still only showing Time not date.

Example of Log:

loggerMsg
TimeStamp: 06:50:59.970
ClientName: ChannelCallbackClient
Severity: Warning
Text: Received ChannelDownReconnecting event on channel Channel
Instance Name Consumer_1_1
RsslReactor 0x0x7fa6ac02f340
RsslChannel 0x0x7fa6ac02ba60
Error Id -1
Internal sysError 107
Error Location /local/jenkins/workspace/RTSDK_Core_DX1/OS/RH8-64/rcdev/source/rtsdk/Cpp-C/Eta/Impl/Reactor/rsslReactorWorker.c:3403
Error Text </local/jenkins/workspace/RTSDK_Core_DX1/OS/RH8-64/rcdev/source/rtsdk/Cpp-C/Eta/Impl/Transport/rsslSocketTransportImpl.c:6165> Error: 1002 ipcConnecting() client connect() failed. System errno: (107)

loggerMsgEnd

Code Snippet:

innerMap.addKeyAscii( "Logger_1", MapEntry::AddEnum, ElementList()
.addEnum( "LoggerType", 0 )
.addAscii( "FileName", m_config.query("emaLogFileName").getString().c_str() )
.addUInt("IncludeDateInLoggerOutput", 1) //Value 1 still does not include date in logger output.
.addUInt("NumberOfLogFiles", 20)
.addUInt("MaxLogFileSize", 100 * 1024 * 1024)
.addEnum( "LoggerSeverity", 1 ).complete() ).complete();

As per the document, IncludeDateInLoggerOutput value 1 should include date. But it is still outputting only Time as shown the log above.

Regards,

Manasendu

Answers

  • Hello @manasendu

    Are you using the latest version of the RTSDK? I used the following configuration with the EMA sample Cons 113 and am able to see the date in the logger output. Most likely you are not applying the programmatic configuration correctly. Please try this through the EMAConfig XML first to verify the issue:

    EMAConfig.xml

    <Consumer>
      <Name value="Consumer_4"/>
      <ChannelSet value="Channel_4"/>
      <Logger value="Logger_1"/>
      <Dictionary value="Dictionary_1"/>
      <XmlTraceToStdout value="0"/>
    </Consumer>
    
    .
    .
    <LoggerGroup>
      <LoggerList>
        <Logger>
          <Name value="Logger_1"/>
          <LoggerType value="LoggerType::Stdout"/>
          <IncludeDateInLoggerOutput value="1" />
          <LoggerSeverity value="LoggerSeverity::Verbose"/>
        </Logger>
    	.
    
    

    Program output:

    loggerMsg
        TimeStamp: 2025/03/14 12:23:12.329
        ClientName: ChannelCallbackClient
        Severity: Verbose
        Text:    Successfully created a Reactor and Channel(s)
            Channel name(s) Channel_4
            Instance Name Consumer_4_1
    loggerMsgEnd
    
    loggerMsg
        TimeStamp: 2025/03/14 12:23:13.807
        ClientName: ItemCallbackClient
        Severity: Verbose
        Text:    Destroyed ItemCallbackClient [Consumer_4_1]
    loggerMsgEnd
    
    loggerMsg
        TimeStamp: 2025/03/14 12:23:13.808
        ClientName: DictionaryCallbackClient
        Severity: Verbose
        Text:    Destroyed DictionaryCallbackClient
    loggerMsgEnd
    
    
  • manasendu
    manasendu Newcomer

    Hi @Gurpreet

    I am using Ema 3.8.2 version. Checked with EmaConfig.xml. In the log it is showing Date & Time.

    <LoggerGroup>

        <LoggerList>
            <Logger>
                <Name value="Logger_1"/>
                <LoggerType value="LoggerType::File"/>
                <!-- FileName is optional: defaulted to "emaLog_<process id>.log"                           -->
                <FileName value="TestingLog"/>
                <LoggerSeverity value="LoggerSeverity::Verbose"/>
                <IncludeDateInLoggerOutput value="1" />
            </Logger>
        </LoggerList>
    </LoggerGroup>
    
    It is working fine (showing date & time) if I use EmaConfig.xml. 
    
    But programatically it is not working.
    
    In the code:
    

    innerMap.addKeyAscii( "Logger", MapEntry::AddEnum, ElementList()
    .addAscii( "Name", "Logger_1" )
    .addEnum( "LoggerType", 0 )
    .addAscii( "FileName", "TestingLog" )
    .addUInt("IncludeDateInLoggerOutput", 1) //Value 1 still does not include date in logger output.
    .addUInt("NumberOfLogFiles", 2)
    .addUInt("MaxLogFileSize", 100 * 1024 * 1024)
    .addEnum( "LoggerSeverity", 0 ).complete() ).complete();

    I can see it is picking up the correct file name, severity of the log is verbose (if I change this value to 1 (Success) it works fine).

    But it is not taking account "IncludeDateInLoggerOutput".

    Thanks!

  • Yes, I tried it for RTSDK C++ and it doesn't work programmatically for me either. We will wait for my other colleagues to see if we are missing something before raising it as an issue on the GitHub.

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @manasendu

    It could be a bug in the library. I have submitted this issue on GitHub.

    You can track the progress from the submitted issue#304.