Bamboo BuildLogger.getLastNLogEntries & getLogEntryCount limitted to 100 lines

Hello

So, I finally found a satisfying solution:

  1. There is a StorageLocationService.getLogFile, which return the log file. So, I directly can parse it. There is also a BuildLogFileAccessorFactory which already returns some higher level facility. However, directly parsing the file is better, so I can ensure that it isn’t loaded into memory by accident.
  2. I had to move the processing from the Agent to the Server =(. (CustomProcessorServer → CustomBuildProcessorServer. This is for two reasons:
    • On the Agent the StorageLocationService still gives you the final location, not the ‘spool’ location. I could calculate that myself.
    • On the Agent the logs are not yet flushed. And there is no API to flush it. So, the spool file is missing things. I would need very, very deep reflection hacks to flush it. That isn’t great.

So, the solution is working I’m mostly happy with it. The only bad thing is that the processing needs to be done on Server. I would prefer to run in on the Agent, so that it distributes the load.

So, the code is roughly this:

StorageLocationService locations = ...

val fullLog = logLocations.getLogFile(buildContext.getPlanResultKey).toPath
try(var lines = Files.lines(fullLog)){
   // stream-process the lines
}

1 Like