diff --git a/src/Runner.Common/Logging.cs b/src/Runner.Common/Logging.cs index 2abf9b548..73a1825b1 100644 --- a/src/Runner.Common/Logging.cs +++ b/src/Runner.Common/Logging.cs @@ -100,7 +100,7 @@ namespace GitHub.Runner.Common { EndPage(); _byteCount = 0; - _dataFileName = Path.Combine(_pagesFolder, $"{_timelineRecordId}_{++_pageCount}.log"); + _dataFileName = Path.Combine(_pagesFolder, $"{_timelineId}_{_timelineRecordId}_{++_pageCount}.log"); _pageData = new FileStream(_dataFileName, FileMode.CreateNew); _pageWriter = new StreamWriter(_pageData, System.Text.Encoding.UTF8); } diff --git a/src/Runner.Listener/JobDispatcher.cs b/src/Runner.Listener/JobDispatcher.cs index 414246383..6e809a91f 100644 --- a/src/Runner.Listener/JobDispatcher.cs +++ b/src/Runner.Listener/JobDispatcher.cs @@ -752,27 +752,32 @@ namespace GitHub.Runner.Listener foreach (var log in logs) { var logName = Path.GetFileNameWithoutExtension(log); + var logNameParts = logName.Split('_', StringSplitOptions.RemoveEmptyEntries); + if (logNameParts.Length != 3) + { + Trace.Warning($"log file '{log}' doesn't follow naming convension 'GUID_GUID_INT'."); + continue; + } var logPageSeperator = logName.IndexOf('_'); var logRecordId = Guid.Empty; var pageNumber = 0; - if (logPageSeperator < 0) + + if (!Guid.TryParse(logNameParts[0], out Guid timelineId) || timelineId != timeline.Id) { - Trace.Warning($"log file '{log}' doesn't follow naming convension 'GUID_INT'."); + Trace.Warning($"log file '{log}' is not belongs to current job"); continue; } - else - { - if (!Guid.TryParse(logName.Substring(0, logPageSeperator), out logRecordId)) - { - Trace.Warning($"log file '{log}' doesn't follow naming convension 'GUID_INT'."); - continue; - } - if (!int.TryParse(logName.Substring(logPageSeperator + 1), out pageNumber)) - { - Trace.Warning($"log file '{log}' doesn't follow naming convension 'GUID_INT'."); - continue; - } + if (!Guid.TryParse(logNameParts[1], out logRecordId)) + { + Trace.Warning($"log file '{log}' doesn't follow naming convension 'GUID_GUID_INT'."); + continue; + } + + if (!int.TryParse(logNameParts[2], out pageNumber)) + { + Trace.Warning($"log file '{log}' doesn't follow naming convension 'GUID_GUID_INT'."); + continue; } var record = timeline.Records.FirstOrDefault(x => x.Id == logRecordId);