Log file - overwrite and/or append

Posted By: DdlV

Log file - overwrite and/or append - 03/16/18 23:14

Hi all. For some time I've noticed that in some (all?) cases when I restart Zorro the log file is treated strangely. It seems that the startup messages replace the beginning of the existing log file, and then the on-going trading messages are appended to the end of the log file. So, I end up with a restarted log file that has

1) The new startup messages
2) Then a bunch of old messages
3) Then the new trading messages

Has anyone else noticed this behavior?

Thanks.
Posted By: Sphin

Re: Log file - overwrite and/or append - 03/18/18 10:42

Not actually. But it could be important to know the version(s) affected. Only in trade ('new trading messages') or also in test mode?
Posted By: DdlV

Re: Log file - overwrite and/or append - 03/18/18 17:13

Hi Sphin. Yes, sorry - I left out a few details... frown

This is in Trade. I don't recall which version I first noticed it, but it happened again in the current 1.74.

It appears that at Trade startup Zorro opens the (existing) log file, overwrites the initial startup messages at the beginning of the file, and then closes the file without truncating it to its new size. Subsequent Trade messages are appended to the file.

If that's what's going on, there seem to be 2 ways to fix Zorro:

1) Always open the log file for append (but this grows the log file indefinitely); or

2) Be sure to truncate the file when overwriting an existing log file (but this loses the old log data)

As a side note, I've also wondered why in Trade startup Zorro doesn't rename an existing log file so it isn't overwritten...

Thanks.
Posted By: jcl

Re: Log file - overwrite and/or append - 03/19/18 10:56

I have just tested it with the latest version, but cannot confirm the problem. There is no command for "truncating" a file. Zorro deletes the old file at start and appends the messages to a new one.

Can you post the log with the strange content?
Posted By: DdlV

Re: Log file - overwrite and/or append - 03/19/18 16:33

Not without redacting it - there's personal & personally identifying info in it!

I can edit that out and/or send it to support - which would you prefer? Unedited it's a ~225KB file.
Posted By: DdlV

Re: Log file - overwrite and/or append - 03/24/18 17:31

Hi jcl. Did you decide which of these options you'd prefer to see the log file?

Thanks.
Posted By: jcl

Re: Log file - overwrite and/or append - 03/26/18 14:03

To support. But if it happens only with your script, we would then also need that script for reproducing the problem.
Posted By: DdlV

Re: Log file - overwrite and/or append - 03/26/18 16:47

Example log file (from Z12) sent.

Thanks.
Posted By: DdlV

Re: Log file - overwrite and/or append - 04/05/18 18:10

For the benefit of anyone following this thread, Support is unable to reproduce. But it continues to happen. It may also involve some interaction with -diag that I also use... Will post again when/if there is a solution.
Posted By: MatPed

Re: Log file - overwrite and/or append - 04/06/18 07:12

thx
© 2024 lite-C Forums