diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 25bf848ca6978659708e88f6f132da57aaa853b5..51314f7368f028b263370c21e10a029ecddc719d 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -996,7 +996,7 @@ void DerivationGoal::killChild()
 
 void DerivationGoal::cancel(bool timeout)
 {
-    if (timeout)
+    if (settings.printBuildTrace && timeout)
         printMsg(lvlError, format("@ build-failed %1% - timeout") % drvPath);
     killChild();
     amDone(ecFailed);
@@ -1609,9 +1609,8 @@ void DerivationGoal::buildDone()
     /* Release the build user, if applicable. */
     buildUser.release();
 
-    if (settings.printBuildTrace) {
+    if (settings.printBuildTrace)
         printMsg(lvlError, format("@ build-succeeded %1% -") % drvPath);
-    }
 
     amDone(ecSuccess);
 }
@@ -2649,7 +2648,7 @@ SubstitutionGoal::~SubstitutionGoal()
 
 void SubstitutionGoal::cancel(bool timeout)
 {
-    if (timeout)
+    if (settings.printBuildTrace && timeout)
         printMsg(lvlError, format("@ substituter-failed %1% timeout") % storePath);
     if (pid != -1) {
         pid_t savedPid = pid;