log file not roll over at restart.

kotaro_okada
kotaro_okada Newcomer
edited September 2 in EMA

Ema config guide says:

Scenario 2:

NumberOfLogFiles > 0; MaxLogFileSize=0

Filename #1 is created and roll over 1st file in case of restart.

So, I configuring logger like this:

<NumberOfLogFiles value="7" />

<MaxLogFileSize value="0" />

I expected that one log file will be created for each time the application (I using sample IProvider 100_MP_Streaming) start,

but actually, even though I start the application many times, contents appended to the first log file, so there is only one file.

Is my understanding wrong? How can I configure logger that creates log files for each time the application start?

Best Answers

  • Jirapongse
    Jirapongse ✭✭✭✭✭
    Answer ✓

    @kotaro_okada

    Thank you for reaching out to us.

    I tested it, and the behavior matches what’s described in the documentation.

    NumberOfLogFiles > 0; MaxLogFileSize=0
    Filename #1 is created and roll over 1st file in case of restart.

    The file emaLog_1.log will be rolled over in case of restart.

    To create new log files for each time the application start, you need to use:

    NumberOfLogFiles=0; MaxLogFileSize=0
    A file with unique pid name is created and grows indefinitely.

    The file will have an associated PID (emaLog_<pid>.log).

    Otherwise, you’ll need to implement logic to rename the emaLog_x.log files to different names when the application starts.

  • Jirapongse
    Jirapongse ✭✭✭✭✭
    Answer ✓

    @kotaro_okada

    The NumberOfLogFiles configuration is used with the MaxLogFileSize configuration.

    When file size reaches the value of "MaxLogFileSize" it is 
    closed and a new file with the next sequential number is
    opened. See "NumberOfLogFiles".

    It could be manually or programmatically.

    For example, when the application starts, it could check if the emaLog_1.log file exists. If the file exists, the application can rename it to a different name.

Answers