Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

How to modify log files of existing builds. #4040

mrinal.das ·

I want to modify log files of existing builds. What function should be used for same need help regarding this

  • replies 5
  • views 35
  • stars 1
robinshen ADMIN ·

Log files can not be modified currently. Any reason you want to do that?

mrinal.das ·

Some of old builds have log information missing which we added in later in our scripts. We need same information in old builds as well as log files are used by other projects.

robinshen ADMIN ·

Check the "" file in QB source code for how to read the log and you should be able to modify/insert entries and write back with groovy script.

mrinal.das ·

I have tried this

logStream = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(logFile), Bootstrap.BUFFER_SIZE)

But what it does is replaces old log with new and doesn't append

logStream = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(logFile,true), Bootstrap.BUFFER_SIZE)
  • This doesn't work as well and I end up with a corrupt file.

Probably because -

robinshen ADMIN ·

Basically you will need to read all entries to a List, and then add your entries to the list. Then finally write all entries in the list to original stream like below:

for (entry: entries) {
logStream.writeObject(null); // indicate that the log reaches to end