-
Bug
-
Resolution: Fixed
-
Major
-
None
-
Timestamper 1.8.8
Jenkins 1.651.3
Viewing the consoleText log with timestamps works, but viewing the plaintext log with time stamps does not work properly. The log is cut short, and the time stamps ends too early.
Console text has proper time stamps:
00:40:41.937 Finished: SUCCESS
Plain text (.../timestamps?appendLog) does not:
00:40:41.937 make[3]: Entering directory '/buildroot/otp-OTP-19.2/erts/lib_src' make[3]: Nothing to be done for 'all'.
The number of timestamps is about 16k, but there are 26k lines in the log. I can see that some parts of the log, e.g. what looks like empty lines, is handled differently in the consoleText part compared to the plaintext part:
consoleText skips empty lines:
00:00:16.744 Sending build context to Docker daemon 19.46 kB 00:00:16.834 Step 1 : FROM openjdk:8u131-jre-alpine
/timestamps does not:
00:00:16.744 Sending build context to Docker daemon 19.46 kB 00:00:16.834 00:00:16.834 00:00:16.835 Step 1 : FROM openjdk:8u131-jre-alpine
Here the time stamp becomes skewed.
It looks like the code which presents the plaintext output does not match the code for the consoleText in some cases which skews the times. This makes the plain text timestamp output essentially useless for most logs.
Looks like in the console it is possible for log messages to contain a new line while being written out as a single entry, but the timestamper reader is assuming each new line delimits a new log entry. Consequently, appear to run out of timestamps.
Looking in a raw log file on disk, it looks like '^M' character is written out to a console log in to indicate a newline within a log line, without indicating a new log line. But the BufferedReader assumes any newline, carriage return or linefeed.
Perhaps simply switching from BufferedReader to Scanner in LogFileReader would be sufficient to solve? Allows use of a delimiter as the end of line token as described at https://stackoverflow.com/a/16712231