Flushing log file buffer manually

Discussion in 'Programming' started by r3eckon, Jul 10, 2025.

  1. r3eckon

    r3eckon
    Expand Collapse

    Joined:
    Jun 15, 2013
    Messages:
    604
    Basically I'm using notepad++ monitoring mode to see live output to the log file (beamng.log) and there is almost always some part of the console output missing from the log file. This isn't a big deal since I can just look at the console itself for that part of the output but I'd love to have the full console output immediately show up in log file. I'm guessing there's some kind of buffer used with the log function to store a certain amount of characters before writing them. My current hack to "flush" that buffer and see the latest output in the log file is printing a ton of characters in console, around 4000 characters seems to do the trick. Actually around half of those characters will still be cut off but since I don't care about them this works to get the latest relevant output written in log file.

    Anyone knows of a better way to do this?
     
  2. stenyak

    stenyak
    Expand Collapse
    Programmer & Global Moderator
    BeamNG Team

    Joined:
    Aug 6, 2012
    Messages:
    2,030
    Flushing on all log messages is intentionally disabled due to the huge performance/framerate impact this can have. However you can try using the -flushLogErrors command line argument to improve things.

    Also you can probably hook up to the in-game console callbacks (used to display logs in the in-game console menu), for full instant access to all logs, if that's of any use.
     
    • Like Like x 1
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice