It’s been a frustration for a long time: oftentimes, you need to dig the log of the build or test run you just did, but didn’t redirect it. When you have enough backlog in your terminal, that can work itself out, but usually, what happens is that you rerun the command, redirecting it to a log file, hoping what you’re looking for will happen again.
For people working on the build system, it’s even worse because it involves someone else: someone comes and say “my build fails with $message”, and usually, thanks to parallel builds, the actual error message is buried deep in their terminal history… when they have a terminal history (Windows console, I’m looking at you).
Anyways, as of bug 985857, as long as you don’t already redirect
mach‘s output to a file, it will now save it for you automatically.
At the moment, the feature is basic, and will store the last log of the last command (mostly). So if you run
mach build followed by
mach xpcshell-test, only the log for the latter will be available, and the log of the former will be lost.
The log is stored in the same format as
mach uses when you give it the
-l argument, which is an aggregate of many json pieces, and not very user friendly. Which is why
mach now also has a new command to read those logs:
By default, it will display the last log
mach stored, but you can also give it the path to any log you got out of
mach with the
So you can do either:
mach -l log-file.json <command>
mach show-log log-file.json
show-log will spawn
less automatically, so that you have paging and search abilities.