11/*
2- * Copyright 2012-2017 the original author or authors.
2+ * Copyright 2012-2018 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -201,8 +201,10 @@ public void addLogFileProperty() {
201201 this .initializer .initialize (this .context .getEnvironment (),
202202 this .context .getClassLoader ());
203203 Log logger = LogFactory .getLog (LoggingApplicationListenerTests .class );
204+ String existingOutput = this .outputCapture .toString ();
204205 logger .info ("Hello world" );
205- String output = this .outputCapture .toString ().trim ();
206+ String output = this .outputCapture .toString ().substring (existingOutput .length ())
207+ .trim ();
206208 assertThat (output ).startsWith ("target/foo.log" );
207209 }
208210
@@ -226,8 +228,10 @@ public void addLogPathProperty() {
226228 this .initializer .initialize (this .context .getEnvironment (),
227229 this .context .getClassLoader ());
228230 Log logger = LogFactory .getLog (LoggingApplicationListenerTests .class );
231+ String existingOutput = this .outputCapture .toString ();
229232 logger .info ("Hello world" );
230- String output = this .outputCapture .toString ().trim ();
233+ String output = this .outputCapture .toString ().substring (existingOutput .length ())
234+ .trim ();
231235 assertThat (output ).startsWith ("target/foo/spring.log" );
232236 }
233237
0 commit comments