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

@@ -6,5 +6,5 @@ jdbc.pass=
# hibernate.X
hibernate.dialect=org.hibernate.dialect.H2Dialect
hibernate.show_sql=true
hibernate.show_sql=false
hibernate.hbm2ddl.auto=create-drop

View File

@@ -6,7 +6,7 @@ jdbc.pass=
# hibernate.X
hibernate.dialect=org.hibernate.dialect.H2Dialect
hibernate.show_sql=true
hibernate.show_sql=false
hibernate.hbm2ddl.auto=create-drop
hibernate.cache.use_second_level_cache=false
hibernate.cache.use_query_cache=false

View File

@@ -4,7 +4,7 @@ jdbc.user=tutorialuser
jdbc.pass=tutorialpass
hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
hibernate.show_sql=true
hibernate.show_sql=false
hibernate.hbm2ddl.auto=create-drop
hibernate.cache.use_second_level_cache=false

View File

@@ -11,7 +11,7 @@
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/HIBERTEST"/>
<property name="javax.persistence.ddl-generation" value="drop-and-create-tables"/>
<property name="javax.persistence.logging.level" value="INFO"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.show_sql" value="false"/>
<property name="hibernate.cache.use_second_level_cache" value="false"/>
<property name="hibernate.cache.use_query_cache" value="false"/>
</properties>

View File

@@ -20,6 +20,8 @@ import com.baeldung.persistence.model.Foo;
import org.junit.Before;
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.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
@@ -31,6 +33,8 @@ import org.springframework.test.context.support.AnnotationConfigContextLoader;
@DirtiesContext
public class FooPaginationPersistenceIntegrationTest {
private static final Logger LOGGER = LoggerFactory.getLogger(FooPaginationPersistenceIntegrationTest.class);
@PersistenceContext
private EntityManager entityManager;
@@ -137,7 +141,7 @@ public class FooPaginationPersistenceIntegrationTest {
typedQuery = entityManager.createQuery(select);
typedQuery.setFirstResult(pageNumber - 1);
typedQuery.setMaxResults(pageSize);
System.out.println("Current page: " + typedQuery.getResultList());
LOGGER.debug("Current page: {}", typedQuery.getResultList());
pageNumber += pageSize;
}

View File

@@ -15,6 +15,8 @@ import com.baeldung.persistence.model.Bar;
import com.baeldung.persistence.model.Foo;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -26,6 +28,8 @@ import org.springframework.test.context.support.AnnotationConfigContextLoader;
@SuppressWarnings("unchecked")
public class FooServiceSortingIntegrationTest {
private static final Logger LOGGER = LoggerFactory.getLogger(FooServiceSortingIntegrationTest.class);
@PersistenceContext
private EntityManager entityManager;
@@ -37,7 +41,7 @@ public class FooServiceSortingIntegrationTest {
final Query sortQuery = entityManager.createQuery(jql);
final List<Foo> fooList = sortQuery.getResultList();
for (final Foo foo : fooList) {
System.out.println("Name:" + foo.getName() + "-------Id:" + foo.getId());
LOGGER.debug("Name:{}-------Id:{}", foo.getName(), foo.getId());
}
}
@@ -47,7 +51,7 @@ public class FooServiceSortingIntegrationTest {
final Query sortQuery = entityManager.createQuery(jql);
final List<Foo> fooList = sortQuery.getResultList();
for (final Foo foo : fooList) {
System.out.println("Name:" + foo.getName() + "-------Id:" + foo.getId());
LOGGER.debug("Name:{}-------Id:{}", foo.getName(), foo.getId());
}
}
@@ -57,7 +61,7 @@ public class FooServiceSortingIntegrationTest {
final Query sortQuery = entityManager.createQuery(jql);
final List<Foo> fooList = sortQuery.getResultList();
for (final Foo foo : fooList) {
System.out.println("Name:" + foo.getName() + "-------Id:" + foo.getId());
LOGGER.debug("Name:{}-------Id:{}", foo.getName(), foo.getId());
}
}
@@ -67,9 +71,9 @@ public class FooServiceSortingIntegrationTest {
final Query barJoinQuery = entityManager.createQuery(jql);
final List<Foo> fooList = barJoinQuery.getResultList();
for (final Foo foo : fooList) {
System.out.println("Name:" + foo.getName());
LOGGER.debug("Name:{}", foo.getName());
if (foo.getBar() != null) {
System.out.print("-------BarId:" + foo.getBar().getId());
LOGGER.debug("-------BarId:{}", foo.getBar().getId());
}
}
}
@@ -80,9 +84,9 @@ public class FooServiceSortingIntegrationTest {
final Query barQuery = entityManager.createQuery(jql);
final List<Bar> barList = barQuery.getResultList();
for (final Bar bar : barList) {
System.out.println("Bar Id:" + bar.getId());
LOGGER.debug("Bar Id:{}", bar.getId());
for (final Foo foo : bar.getFooList()) {
System.out.println("FooName:" + foo.getName());
LOGGER.debug("FooName:{}", foo.getName());
}
}
}
@@ -97,7 +101,7 @@ public class FooServiceSortingIntegrationTest {
final TypedQuery<Foo> typedQuery = entityManager.createQuery(select);
final List<Foo> fooList = typedQuery.getResultList();
for (final Foo foo : fooList) {
System.out.println("Name:" + foo.getName() + "--------Id:" + foo.getId());
LOGGER.debug("Name:{}-------Id:{}", foo.getName(), foo.getId());
}
}
@@ -111,7 +115,7 @@ public class FooServiceSortingIntegrationTest {
final TypedQuery<Foo> typedQuery = entityManager.createQuery(select);
final List<Foo> fooList = typedQuery.getResultList();
for (final Foo foo : fooList) {
System.out.println("Name:" + foo.getName() + "-------Id:" + foo.getId());
LOGGER.debug("Name:{}-------Id:{}", foo.getName(), foo.getId());
}
}

View File

@@ -13,6 +13,8 @@ import com.baeldung.config.PersistenceJPAConfig;
import com.baeldung.persistence.model.Foo;
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.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
@@ -24,6 +26,8 @@ import org.springframework.test.context.support.AnnotationConfigContextLoader;
@DirtiesContext
public class FooServiceSortingWitNullsManualIntegrationTest {
private static final Logger LOGGER = LoggerFactory.getLogger(FooServiceSortingWitNullsManualIntegrationTest.class);
@PersistenceContext
private EntityManager entityManager;
@@ -43,7 +47,7 @@ public class FooServiceSortingWitNullsManualIntegrationTest {
final List<Foo> fooList = sortQuery.getResultList();
assertNull(fooList.get(fooList.toArray().length - 1).getName());
for (final Foo foo : fooList) {
System.out.println("Name:" + foo.getName());
LOGGER.debug("Name:{}", foo.getName());
}
}
@@ -57,7 +61,7 @@ public class FooServiceSortingWitNullsManualIntegrationTest {
final List<Foo> fooList = sortQuery.getResultList();
assertNull(fooList.get(0).getName());
for (final Foo foo : fooList) {
System.out.println("Name:" + foo.getName());
LOGGER.debug("Name:{}", foo.getName());
}
}

View File

@@ -2,7 +2,7 @@ jdbc.driverClassName=org.h2.Driver
jdbc.url=jdbc:h2:mem:myDb;DB_CLOSE_DELAY=-1
hibernate.dialect=org.hibernate.dialect.H2Dialect
hibernate.show_sql=true
hibernate.show_sql=false
hibernate.hbm2ddl.auto=create
hibernate.cache.use_second_level_cache=false