| |
126 |
126 |
|
| |
127 |
127 |
strError = boost::str(boost::wformat(L"Asynchronous logger critical failure: waiting failed with error %1%. Logging will be disabled until the application will be restarted.") % dwLastError); |
| |
128 |
128 |
pAsyncLogger->m_bLoggingEnabled = false; |
| |
129 |
129 |
|
| |
130 |
130 |
bStopProcessing = true; |
| |
131 |
131 |
} |
| |
132 |
132 |
|
| |
133 |
133 |
std::vector<TLogFileDataPtr> vLogs; |
| |
134 |
134 |
{ |
| |
135 |
135 |
boost::shared_lock<boost::shared_mutex> lock(pAsyncLogger->m_mutex); |
| |
136 |
136 |
vLogs.insert(vLogs.begin(), pAsyncLogger->m_setLoggerData.begin(), pAsyncLogger->m_setLoggerData.end()); |
| |
137 |
137 |
} |
| |
138 |
138 |
|
| |
139 |
139 |
for(const TLogFileDataPtr& spLogData : vLogs) |
| |
140 |
140 |
{ |
| |
141 |
141 |
try |
| |
142 |
142 |
{ |
| |
143 |
143 |
|
| |
144 |
144 |
if(!strError.empty()) |
| |
145 |
145 |
{ |
| |
146 |
|
spLogData->PushLogEntry(strError); |
| |
|
146 |
spLogData->PushLogEntry(strError.c_str()); |
| |
147 |
147 |
spLogData->DisableLogging(); |
| |
148 |
148 |
} |
| |
149 |
149 |
|
| |
150 |
150 |
spLogData->StoreLogEntries(); |
| |
151 |
151 |
spLogData->CloseUnusedFile(); |
| |
152 |
152 |
} |
| |
153 |
153 |
catch(const std::exception& e) |
| |
154 |
154 |
{ |
| |
155 |
155 |
e; |
| |
156 |
156 |
ATLTRACE(e.what()); |
| |
157 |
157 |
} |
| |
158 |
158 |
} |
| |
159 |
159 |
} |
| |
160 |
160 |
while(!bStopProcessing); |
| |
161 |
161 |
} |
| |
162 |
162 |
catch(const std::exception&) |
| |
163 |
163 |
{ |
| |
164 |
164 |
} |
| |
165 |
165 |
|
| |
166 |
166 |
SetEvent(pAsyncLogger->m_spStoppedEvent.get()); |