Reputation: 518
I have a set of Tasks inside a build.cake
file and I would like to capture the log output from the console into a log file. I know it's possible to use the OnError()
function to output errors to file but I would like to output everything to a log file, not just errors.
Below is an example of the build.cake
file.
#load "SomeTask.cake"
#load "SomeOtherTask.cake"
var target = Argument("target", "Default");
var someTask = Task("SomeTask")
.Does(() =>
{
SomeMethodInsideSomeTask();
});
var someOtherTask = Task("SomeOtherTask")
.Does(() =>
{
SomeOtherMethodInsideSomeOtherTask();
});
Task("Default")
.IsDependentOn(someTask)
.IsDependentOn(someOtherTask);
RunTarget(target);
N.B. The Tasks are not running any sort of MSBuild
commands so it's not possible to use MSBuildFileLogger.
Upvotes: 2
Views: 2218