JAVA-8435: reducing logging for tutorials-integration job

This commit is contained in:
chaos2418
2021-11-20 09:45:50 +05:30
parent a0dbe854b7
commit fa1f32f186
53 changed files with 300 additions and 122 deletions

View File

@@ -9,6 +9,8 @@ import com.baeldung.spring.jdbc.template.guide.config.SpringJdbcConfig;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.test.context.ContextConfiguration;
@@ -19,6 +21,8 @@ import org.springframework.test.context.support.AnnotationConfigContextLoader;
@ContextConfiguration(classes = { SpringJdbcConfig.class }, loader = AnnotationConfigContextLoader.class)
public class EmployeeDAOIntegrationTest {
private static final Logger LOGGER = LoggerFactory.getLogger(EmployeeDAOIntegrationTest.class);
@Autowired
private EmployeeDAO employeeDao;
@@ -70,7 +74,7 @@ public class EmployeeDAOIntegrationTest {
try {
employeeDao.addEmplyee(7);
} catch (final DuplicateKeyException e) {
System.out.println(e.getMessage());
LOGGER.error(e.getMessage(), e);
Assert.assertTrue(e.getMessage().contains("Custome Exception translator - Integrity contraint voilation."));
}
}

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="15 seconds" debug="false">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>[%d{ISO8601}]-[%thread] %-5level %logger - %msg%n</pattern>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="STDOUT" />
</root>
</configuration>