@@ -214,18 +214,17 @@ public void run() {
214214 try {
215215 boolean readerDone = false ;
216216 boolean errorReaderDone = false ;
217+ String currentLog = null ;
217218 while (!readerDone || !errorReaderDone ) {
218219 if (!readerDone && reader .ready ()) {
219- readerDone = reader .readLine () ! = null ;
220+ readerDone = reader .readLine () = = null ;
220221 }
221222 if (!errorReaderDone && errorReader .ready ()) {
222223 String errorOutput = errorReader .readLine ();
223224 if (errorOutput == null ) {
224225 errorReaderDone = true ;
225226 } else {
226- if (errorOutput .startsWith ("SEVERE" )) {
227- System .err .println (errorOutput );
228- }
227+ currentLog = processLog (errorOutput , currentLog );
229228 }
230229 }
231230 }
@@ -234,6 +233,27 @@ public void run() {
234233 }
235234 }
236235
236+ private static boolean isNewGcdLog (String line ) {
237+ return line .contains ("com.google.apphosting.client.serviceapp.BaseApiServlet" )
238+ && !line .trim ().startsWith ("at " );
239+ }
240+
241+ private static String processLog (String currentLine , String currentLog ) {
242+ if (isNewGcdLog (currentLine )) {
243+ if (currentLog != null ) {
244+ log .info (currentLog .trim ());
245+ }
246+ return "GCD " ;
247+ } else if (currentLine .startsWith ("SEVERE: " )) {
248+ return null ; // Don't show duplicate error messages from gcd.sh
249+ } else if (currentLog != null && currentLine .startsWith ("INFO: " )) {
250+ return currentLog + currentLine .substring ("INFO: " .length ()) + "\n " ;
251+ } else if (currentLog != null && !currentLine .trim ().startsWith ("at " )) {
252+ return currentLog + currentLine + "\n " ;
253+ }
254+ return currentLog ;
255+ }
256+
237257 public static ProcessStreamReader start (
238258 Process process , String blockUntil , boolean blockOnErrorStream ) throws IOException {
239259 ProcessStreamReader thread = new ProcessStreamReader (process , blockUntil , blockOnErrorStream );
0 commit comments