diff --git a/lib/spack/spack/reporters/cdash.py b/lib/spack/spack/reporters/cdash.py
index 638cc7a88953090e1c9713fc1694d1ea7121a566..5ba2c0c6cc42fda4c866c0ff9fe771dd88983f42 100644
--- a/lib/spack/spack/reporters/cdash.py
+++ b/lib/spack/spack/reporters/cdash.py
@@ -78,7 +78,7 @@ def build_report(self, filename, report_data):
 
         for phase in cdash_phases:
             report_data[phase] = {}
-            report_data[phase]['log'] = ""
+            report_data[phase]['loglines'] = []
             report_data[phase]['status'] = 0
             report_data[phase]['endtime'] = self.endtime
 
@@ -97,7 +97,9 @@ def build_report(self, filename, report_data):
                     current_phase = ''
                     cdash_phase = ''
                     for line in package['stdout'].splitlines():
-                        match = phase_regexp.search(line)
+                        match = None
+                        if line.find("Executing phase: '") != -1:
+                            match = phase_regexp.search(line)
                         if match:
                             current_phase = match.group(1)
                             if current_phase not in map_phases_to_cdash:
@@ -107,12 +109,12 @@ def build_report(self, filename, report_data):
                                 map_phases_to_cdash[current_phase]
                             if cdash_phase not in phases_encountered:
                                 phases_encountered.append(cdash_phase)
-                            report_data[cdash_phase]['log'] += \
-                                text_type("{0} output for {1}:\n".format(
-                                    cdash_phase, package['name']))
+                            report_data[cdash_phase]['loglines'].append(
+                                text_type("{0} output for {1}:".format(
+                                    cdash_phase, package['name'])))
                         elif cdash_phase:
-                            report_data[cdash_phase]['log'] += \
-                                xml.sax.saxutils.escape(line) + "\n"
+                            report_data[cdash_phase]['loglines'].append(
+                                xml.sax.saxutils.escape(line))
 
         phases_encountered.append('update')
 
@@ -126,8 +128,9 @@ def build_report(self, filename, report_data):
         self.starttime = self.endtime - total_duration
         for phase in phases_encountered:
             report_data[phase]['starttime'] = self.starttime
-            errors, warnings = parse_log_events(
-                report_data[phase]['log'].splitlines())
+            report_data[phase]['log'] = \
+                '\n'.join(report_data[phase]['loglines'])
+            errors, warnings = parse_log_events(report_data[phase]['loglines'])
             nerrors = len(errors)
 
             if phase == 'configure' and nerrors > 0: