Spring Boot Test ignores logging.level -


one of maven module ignores logging levels when running tests.

in src/test/resources have application.properties:

app.name=bbsng-import-backend app.description=import backend module application spring.profiles.active=test  # logging logging.level.root=error logging.level.org.springframework.core =fatal logging.level.org.springframework.beans=fatal logging.level.org.springframework.context=fatal logging.level.org.springframework.transaction=error logging.level.org.springframework.test=error logging.level.org.springframework.web=error logging.level.org.hibernate=error 

i tried application-test.properties.

my application logs lot, espacially when loading context. tried logback.xml, logback-test.xml , logback-spring.xml. nothing helps.

my pom:

<parent>     <groupid>at.company.bbsng</groupid>     <artifactid>bbsng-import</artifactid>     <version>0.1.0-snapshot</version> </parent>  <artifactid>bbsng-import-backend</artifactid> <name>bbsng-import-backend</name>  <properties>     <start-class>at.company.bbsng.dataimport.applicationimportbackend</start-class> </properties>   <dependencies>      <!-- application ... -->     <dependency>         <groupid>at.company.bbsng</groupid>         <artifactid>bbsng-app-domain</artifactid>         <scope>test</scope>     </dependency>      <!-- spring ... -->     <dependency>         <groupid>org.springframework.boot</groupid>         <artifactid>spring-boot-starter-batch</artifactid>     </dependency>     <dependency>         <groupid>org.springframework.boot</groupid>         <artifactid>spring-boot-starter-test</artifactid>         <scope>test</scope>     </dependency>     <dependency>         <groupid>org.springframework.boot</groupid>         <artifactid>spring-boot-starter-data-jpa</artifactid>         <scope>test</scope>     </dependency>      <!-- javax ... -->        ...      <!-- commons ... -->        ...      <!-- lombok ... -->        ...      <!-- db -->        ...  </dependencies>  <build>     <plugins>         <plugin>             <groupid>org.springframework.boot</groupid>             <artifactid>spring-boot-maven-plugin</artifactid>             <version>${org.springframework.boot-version}</version>             <executions>                 <execution>                     <goals>                         <goal>repackage</goal>                     </goals>                 </execution>             </executions>         </plugin>     </plugins> </build> 

one simple test class:

@contextconfiguration(classes = { applicationimportbackend.class }) @runwith(springjunit4classrunner.class) @activeprofiles({ "test" }) public class batchjobconfigurationtests {      @autowired     private joblauncher joblauncher;      @test     public void testsimpleproperties() throws exception {         assertnotnull(joblauncher);     }  } 

application logs in debug mode.

and yes, application.properties loaded. tried out break application wrong config.

thank hints.

okay did now, in modules configured follows:

src/main/resources:
use logging configuration in application.properies logging.level.* descrbed in question.

src/test/resources:
use logback-test.xml like:

<?xml version="1.0" encoding="utf-8"?> <configuration>     <include resource="org/springframework/boot/logging/logback/base.xml" />     <logger name="*.myapp" level="error" />     <logger name="org.springframework.core " level="error" />     <logger name="org.springframework.beans" level="error" />     <logger name="org.springframework.context" level="error" />     <logger name="org.springframework.transaction" level="error" />     <logger name="org.springframework.web" level="error" />     <logger name="org.springframework.test" level="error" />     <logger name="org.hibernate" level="error" /> </configuration> 

but still don't understand, why in few modules use application.properties, in module ignores ... works me is.

but maybe few hints background knowledge still welcome.

i dont mark answer solution, cos still feels workaround.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -