0

Is there a way to get drake::log() messages to flush to output? I'm finding that in my use case the difference between the time a log message appears and the the time stamp of the message is on the order of minutes and I'd like a little faster logging response.

Mark
  • 51
  • 2

1 Answers1

1

By default, each log message should already be flushed:

https://github.com/gabime/spdlog/blob/v1.5.0/include/spdlog/sinks/stdout_sinks-inl.h#L32

There must be something else going on in your configuration.

jwnimmer-tri
  • 1,994
  • 2
  • 5
  • 6
  • I'm calling the code that does the logging from a Jupyter notebook. Could that be interfering? – Mark Oct 28 '21 at 16:55
  • Ah. For pydrake, logs go to https://docs.python.org/3/library/logging.html. I don't know off the top of my head when/how that flushes. – jwnimmer-tri Oct 28 '21 at 17:00
  • Hmm. It's a `import pydrake.common` that sets up logging. It _should_ be the case that that always precedes any use of Drake C++ logging, but you might try importing that specifically and see if it helps. – jwnimmer-tri Oct 28 '21 at 17:08