276 _rotation_semaphore.signal(); |
276 _rotation_semaphore.signal(); |
277 |
277 |
278 return written; |
278 return written; |
279 } |
279 } |
280 |
280 |
|
281 int LogFileOutput::write(LogMessageBuffer::Iterator msg_iterator) { |
|
282 if (_stream == NULL) { |
|
283 // An error has occurred with this output, avoid writing to it. |
|
284 return 0; |
|
285 } |
|
286 |
|
287 _rotation_semaphore.wait(); |
|
288 int written = LogFileStreamOutput::write(msg_iterator); |
|
289 _current_size += written; |
|
290 |
|
291 if (should_rotate()) { |
|
292 rotate(); |
|
293 } |
|
294 _rotation_semaphore.signal(); |
|
295 |
|
296 return written; |
|
297 } |
|
298 |
281 void LogFileOutput::archive() { |
299 void LogFileOutput::archive() { |
282 assert(_archive_name != NULL && _archive_name_len > 0, "Rotation must be configured before using this function."); |
300 assert(_archive_name != NULL && _archive_name_len > 0, "Rotation must be configured before using this function."); |
283 int ret = jio_snprintf(_archive_name, _archive_name_len, "%s.%0*u", |
301 int ret = jio_snprintf(_archive_name, _archive_name_len, "%s.%0*u", |
284 _file_name, _file_count_max_digits, _current_file); |
302 _file_name, _file_count_max_digits, _current_file); |
285 assert(ret >= 0, "Buffer should always be large enough"); |
303 assert(ret >= 0, "Buffer should always be large enough"); |