1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

log: better message when reached log limit

Add explaining message, when command was aborted due to the reach
of configure line number count (LVM_LOG_FILE_MAX_LINES)
for logging (used mainly with testing).
This commit is contained in:
Zdenek Kabelac 2017-10-26 13:55:36 +02:00
parent 1758614f96
commit 837bfab75c

View File

@ -646,11 +646,16 @@ static void _vprint_log(int level, const char *file, int line, int dm_errno_or_c
vfprintf(_log_file, trformat, ap);
va_end(ap);
if (_log_file_max_lines && ++_log_file_lines >= _log_file_max_lines) {
fprintf(_log_file, "\n%s:%d %sAborting. Command has reached limit "
"for logged lines (LVM_LOG_FILE_MAX_LINES=" FMTu64 ").",
file, line, _msg_prefix,
_log_file_max_lines);
fatal_internal_error = 1;
}
fputc('\n', _log_file);
fflush(_log_file);
if (_log_file_max_lines && ++_log_file_lines >= _log_file_max_lines)
fatal_internal_error = 1;
}
if (_syslog && (_log_while_suspended || !critical_section())) {