I've just found this suspicious log messages (I've added line numbers in the attachment pgagent.log):
8 Tue May 8 11:11:23 2018 DEBUG: Creating DB connection: service=xiserver56_tisdbadm cTue May o8nne ct_timeout11:=151: 23 201 8applica DEBtUion_nameG: S=pglaeegpeinngt.@.d.e 9 v_tisdevel dbname=dev_tisdevel
Note how line 8 and 9 are actually two log messages, which should have been printed in two lines:
Tue May 8 11:11:23 2018 DEBUG: Creating DB connection: service=xiserver56_tisdbadm connect_timeout=5 application_name=pgagent@dev_tisdevel dbname=dev_tisdevel Tue May 8 11:11:23 2018 DEBUG: Sleeping...
It appears that two threads are writing to stdout at the same time, which calls for an exclusive lock in function void LogMessage(const std::wstring &msg, const int &level)