{"action":"closed","issue":{"url":"https://api.github.com/repos/gabime/spdlog/issues/147","labels_url":"https://api.github.com/repos/gabime/spdlog/issues/147/labels{/name}","comments_url":"https://api.github.com/repos/gabime/spdlog/issues/147/comments","events_url":"https://api.github.com/repos/gabime/spdlog/issues/147/events","html_url":"https://github.com/gabime/spdlog/issues/147","id":117711238,"number":147,"title":"Flush before close loses logs in async mode","user":{"login":"oconnore","id":1103746,"avatar_url":"https://avatars.githubusercontent.com/u/1103746?v=3","gravatar_id":"","url":"https://api.github.com/users/oconnore","html_url":"https://github.com/oconnore","followers_url":"https://api.github.com/users/oconnore/followers","following_url":"https://api.github.com/users/oconnore/following{/other_user}","gists_url":"https://api.github.com/users/oconnore/gists{/gist_id}","starred_url":"https://api.github.com/users/oconnore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oconnore/subscriptions","organizations_url":"https://api.github.com/users/oconnore/orgs","repos_url":"https://api.github.com/users/oconnore/repos","events_url":"https://api.github.com/users/oconnore/events{/privacy}","received_events_url":"https://api.github.com/users/oconnore/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/gabime/spdlog/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":{"login":"gabime","id":6052198,"avatar_url":"https://avatars.githubusercontent.com/u/6052198?v=3","gravatar_id":"","url":"https://api.github.com/users/gabime","html_url":"https://github.com/gabime","followers_url":"https://api.github.com/users/gabime/followers","following_url":"https://api.github.com/users/gabime/following{/other_user}","gists_url":"https://api.github.com/users/gabime/gists{/gist_id}","starred_url":"https://api.github.com/users/gabime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabime/subscriptions","organizations_url":"https://api.github.com/users/gabime/orgs","repos_url":"https://api.github.com/users/gabime/repos","events_url":"https://api.github.com/users/gabime/events{/privacy}","received_events_url":"https://api.github.com/users/gabime/received_events","type":"User","site_admin":false},"milestone":null,"comments":3,"created_at":"2015-11-19T00:09:52Z","updated_at":"2015-11-28T14:22:13Z","closed_at":"2015-11-28T14:22:13Z","body":"Perhaps similar to #145, but in async mode. I haven't figured out a way to force all logs to write + flush to file before closing the program. \r\n\r\nThe patch would likely involve changing the busy wait behavior here: https://github.com/gabime/spdlog/blob/cbc8ba72035a3828f3a03e425e7f0d91da6c2ba3/include/spdlog/details/async_log_helper.h#L265-L267 . Using a per-log [condition variable `wait_for`](http://en.cppreference.com/w/cpp/thread/condition_variable/wait_for) instead of a non-interruptible thread `sleep_for` would allow a log-flush to immediately drain the log queue, and then call per-sink flushes. \r\n\r\nWould you be open to a patch? Is there a reason to be busy waiting here at all? "}}