0

I know tickerplant will write tplog when it receives data. at the end of the day, ticker plant will start writing a new tplog. I see tp.q but cannot figure out which function does that. I know .u.tick start writing the tplog on disk but dont see which command make the tplog start writing new tplog next day? Can someone please point me out?

Terry
  • 523
  • 9
  • 21

1 Answers1

2

.u.ts runs on a timer, constantly checking for end of day. At end of day it calls .u.endofday, which calls .u.ld.

.u.ld checks for existence of a log file with the current date in its name, if this file does not exist, it creates it.

.u.ld is responsible for creating the new log file each day

Adam Bonham
  • 615
  • 4
  • 7
  • is there a way to test it if it works right away so dont need to wait until next day? like to see if the tplog actually is written a new one? – Terry Jan 08 '21 at 14:15
  • You can call .u.ld yourself, it takes a date as its parameter. If you call it with tomorrows date, it will check for existence of the file, if not present it will create it (path is .u.L). The last part of .u.ld opens a handle to the newly created log file. If you call it by itself you will want to assign it to .u.l to do the logging. Something like .u.l:.u.ld .z.d+1 You should be able to see the log file on disk, or check for existence with key .u.L – Adam Bonham Jan 08 '21 at 15:31
  • thanks a lot!! just did it and new log is created. However, I tested it a couple days with this CTP logs, it does log when I just start for that day. but it stopped at 0:00 and it doesnt create a new log. for next day. not sure why. i tried .u.ld[2021.01.09] and new log was created though. – Terry Jan 08 '21 at 16:16
  • so i added a timer and rerun .u.tick at 00:00. it will hopen a new file again. I am just wondering if .u.l is assigned to open a new file, will the old one automatically close? – Terry Jan 14 '21 at 21:31
  • A handle to a file wont close by itself if the file exists, .u.endofday calls hclose to close the old connection. You can overwrite .u.l with a new handle, though it won't close the old one – Adam Bonham Jan 14 '21 at 21:55