boost::log add_file_log not writing if app exits with CTRL_CLOSE_EVENT

时光怂恿深爱的人放手 提交于 2019-12-02 10:16:10

Two thing you may want to look at. The following is based on my experience

1) The log file exists but is empty. In this case use auto_flush to flush the log to disk as the log messages are created. Other wise you could end up with an empty log if there is not enough log messages to be flushed when CTRL_CLOSE_EVENT occurs.

2) The log file exits but is not were you think it is. In this case make sure that the log file is created in the same directory as the target directory. The target directory collects the log files when the sinks are closed. If the keyword file_name is set to a file name only it will be created in the working directory, not the target directory. If the application exits without closing the the sinks then the file will not be moved to the target directory.

HTH,

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!