Index: src/webapp/webservice/inc/GnuBoat/ServiceLogFiles.php
===================================================================
--- src/webapp/webservice/inc/GnuBoat/ServiceLogFiles.php	(revision 008bce99c15e3dad6fcf395f8c3a3f69b23b4b28)
+++ src/webapp/webservice/inc/GnuBoat/ServiceLogFiles.php	(revision f36cf9fcfc63c7646ea5a94ffb899d9593689dc1)
@@ -39,70 +39,61 @@
 			$files = glob($config->logDirectory() ."*.log");
 			array_walk($files, 'GnuBoat\ServiceLogFiles::stripLogDirectory');
+			return $this->output($files);
+		}
 
-			header('Content-Type: application/json');
-			if($debug > 0){
-				echo json_encode($files,  JSON_PRETTY_PRINT) ."\n";
+		// prepare a download of available log files
+		$files = $_POST["logfilesSelected"];
+		if(count($files) < 1)
+			return $this->error("No logfile selected");
+		elseif(count($files) == 1){
+			$content = file_get_contents($config->logDirectory() . $files[0]);
+			if($content === false){
+				echo "<html><head></head><body>Failed to read logfile ". $files[0] ."</body></html>";
 			}
-			else{
-				echo json_encode($files) ."\n";
-			}
+		
+			header('Content-Type: text/plain');
+			header('Content-disposition: attachment; filename="'. $files[0] .'"');
+			header('Content-Length: ' . filesize($config->logDirectory() . $files[0]));
+			echo $content;
 		}
 		else{
-			// prepare a download of available log files
-			$files = $_POST["logfilesSelected"];
-			if(count($files) < 1){
+			$date = new \DateTime('NOW');
+			$archiveName = "gnuboat-logs-". $date->format("Y-m-d");
+		
+			// provide files as zip file
+			$tmpArchive = tempnam(sys_get_temp_dir(), $archiveName);
+			$zip = new \ZipArchive();
+			if($zip->open($tmpArchive, \ZipArchive::CREATE) !== TRUE){
+				echo "<html><head></head><body>Failed to create zip file</body></html>";
 				return;
 			}
-			elseif(count($files) == 1){
-				$content = file_get_contents($config->logDirectory() . $files[0]);
-				if($content === false){
-					echo "<html><head></head><body>Failed to read logfile ". $files[0] ."</body></html>";
-				}
-			
-				header('Content-Type: text/plain');
-				header('Content-disposition: attachment; filename="'. $files[0] .'"');
-				header('Content-Length: ' . filesize($config->logDirectory() . $files[0]));
-				echo $content;
-			}
-			else{
-				$date = new \DateTime('NOW');
-				$archiveName = "gnuboat-logs-". $date->format("Y-m-d");
-			
-				// provide files as zip file
-				$tmpArchive = tempnam(sys_get_temp_dir(), $archiveName);
-				$zip = new \ZipArchive();
-				if($zip->open($tmpArchive, \ZipArchive::CREATE) !== TRUE){
-					echo "<html><head></head><body>Failed to create zip file</body></html>";
+			foreach($files as $file){
+				if($zip->addFile($config->logDirectory() . $file, $archiveName ."/". $file) !== true){
+					$zip->close();
+					echo "<html><head></head><body>Failed to add logfile ". $file ." to the zip file</body></html>";
 					return;
 				}
-				foreach($files as $file){
-					if($zip->addFile($config->logDirectory() . $file, $archiveName ."/". $file) !== true){
-						$zip->close();
-						echo "<html><head></head><body>Failed to add logfile ". $file ." to the zip file</body></html>";
-						return;
-					}
-				}
-				if($zip->close() !== true){
-						echo "<html><head></head><body>Failed to save zip file</body></html>";
-						return;
-				}
-				
-				echo "<html><head></head><body>Failed to add logfile ". $file ." to the zip file</body></html>";
-				
-				//Send zip folder
-				while (ob_get_level()) {
-					ob_end_clean();
-				}
-				ob_start();
-				header('Content-Type: application/zip');
-				header('Content-Transfer-Encoding: Binary');
-				header('Content-disposition: attachment; filename=' . $archiveName . '.zip');
-				header('Content-Length: ' . filesize($tmpArchive));
-				ob_flush();
-				ob_clean();
-				readfile($tmpArchive);
-				unlink($tmpArchive);
-				return;
 			}
+			if($zip->close() !== true){
+					echo "<html><head></head><body>Failed to save zip file</body></html>";
+					return;
+			}
+			
+			echo "<html><head></head><body>Failed to add logfile ". $file ." to the zip file</body></html>";
+			
+			//Send zip folder
+			while (ob_get_level()) {
+				ob_end_clean();
+			}
+			ob_start();
+			header('Content-Type: application/zip');
+			header('Content-Transfer-Encoding: Binary');
+			header('Content-disposition: attachment; filename=' . $archiveName . '.zip');
+			header('Content-Length: ' . filesize($tmpArchive));
+			ob_flush();
+			ob_clean();
+			readfile($tmpArchive);
+			unlink($tmpArchive);
+			return;
 		}
 	}
