File tree Expand file tree Collapse file tree
java/ru/javawebinar/topjava/service Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66
77 <context : property-placeholder location =" classpath:db/postgres.properties" system-properties-mode =" OVERRIDE" />
88
9+ <!--
10+ For postgres driver logging
11+ It uses java.util.logging and logged via jul-to-slf4j bridge
12+ https://stackoverflow.com/a/27296470/548473
13+ -->
14+ <bean class =" org.springframework.beans.factory.config.MethodInvokingBean" >
15+ <property name =" staticMethod" value =" org.slf4j.bridge.SLF4JBridgeHandler.install" />
16+ </bean >
17+
918 <!-- no pooling-->
1019 <bean id =" dataSource"
1120 class =" org.springframework.jdbc.datasource.DriverManagerDataSource" >
Original file line number Diff line number Diff line change 22
33import org .junit .Test ;
44import org .junit .runner .RunWith ;
5- import org .slf4j .bridge .SLF4JBridgeHandler ;
65import org .springframework .beans .factory .annotation .Autowired ;
76import org .springframework .dao .DataAccessException ;
87import org .springframework .test .context .ContextConfiguration ;
2827@ Sql (scripts = "classpath:db/populateDB.sql" , config = @ SqlConfig (encoding = "UTF-8" ))
2928public class MealServiceTest {
3029
31- static {
32- SLF4JBridgeHandler .install ();
33- }
34-
3530 @ Autowired
3631 private MealService service ;
3732
Original file line number Diff line number Diff line change 22
33import org .junit .Test ;
44import org .junit .runner .RunWith ;
5- import org .slf4j .bridge .SLF4JBridgeHandler ;
65import org .springframework .beans .factory .annotation .Autowired ;
76import org .springframework .dao .DataAccessException ;
87import org .springframework .test .context .ContextConfiguration ;
2726@ Sql (scripts = "classpath:db/populateDB.sql" , config = @ SqlConfig (encoding = "UTF-8" ))
2827public class UserServiceTest {
2928
30- static {
31- // Only for postgres driver logging
32- // It uses java.util.logging and logged via jul-to-slf4j bridge
33- SLF4JBridgeHandler .install ();
34- }
35-
3629 @ Autowired
3730 private UserService service ;
3831
Original file line number Diff line number Diff line change 1212 </appender >
1313
1414 <logger name =" org.postgresql" level =" debug" />
15- <logger name =" org.springframework.jdbc" level =" debug " />
15+ <logger name =" org.springframework.jdbc" level =" info " />
1616 <logger name =" ru.javawebinar.topjava" level =" debug" />
1717
1818 <root level =" INFO" >
You can’t perform that action at this time.
0 commit comments