Skip to content

Instantly share code, notes, and snippets.

@eriwen
Created May 3, 2018 15:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eriwen/c8efa12bcd27a36b499b09e9428868cf to your computer and use it in GitHub Desktop.
Save eriwen/c8efa12bcd27a36b499b09e9428868cf to your computer and use it in GitHub Desktop.
Fix stderr in plain console in Gradle 4.7
rootProject {
def errorFile = file("${rootProject.buildDir}/errors.log")
def errorListener = new ErrorCapture(errorFile)
allprojects {
logging.addStandardErrorListener(errorListener)
tasks.all {
logging.addStandardErrorListener(errorListener)
}
}
}
class ErrorCapture implements StandardOutputListener {
private final File errorFile
ErrorCapture(File errorFile) {
this.errorFile = errorFile
errorFile.parentFile.mkdirs()
}
void onOutput(CharSequence output) {
errorFile << output
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment