[JAVA-11892] Logging clean up
This commit is contained in:
parent
8ab490ca80
commit
1efe19f383
|
@ -17,7 +17,7 @@ public class AvailableCiphersUnitTest {
|
||||||
public void whenGetServices_thenGetAllCipherAlgorithms() {
|
public void whenGetServices_thenGetAllCipherAlgorithms() {
|
||||||
for (Provider provider : Security.getProviders()) {
|
for (Provider provider : Security.getProviders()) {
|
||||||
for (Provider.Service service : provider.getServices()) {
|
for (Provider.Service service : provider.getServices()) {
|
||||||
logger.info(service.getAlgorithm());
|
logger.debug(service.getAlgorithm());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,6 @@ public class AvailableCiphersUnitTest {
|
||||||
.map(Provider.Service::getAlgorithm)
|
.map(Provider.Service::getAlgorithm)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
algorithms.forEach(logger::info);
|
algorithms.forEach(logger::debug);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration>
|
||||||
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
|
||||||
|
</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<root level="INFO">
|
||||||
|
<appender-ref ref="STDOUT" />
|
||||||
|
</root>
|
||||||
|
</configuration>
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
|
||||||
|
<log4j:configuration debug="false" xmlns:log4j='http://jakarta.apache.org/log4j/'>
|
||||||
|
|
||||||
|
<appender name="console" class="org.apache.log4j.ConsoleAppender">
|
||||||
|
<layout class="org.apache.log4j.PatternLayout">
|
||||||
|
<param name="ConversionPattern"
|
||||||
|
value="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n" />
|
||||||
|
</layout>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<logger name="org.hibernate" additivity="false">
|
||||||
|
<level value="ERROR" />
|
||||||
|
<appender-ref ref="console" />
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<root>
|
||||||
|
<level value="INFO" />
|
||||||
|
<appender-ref ref="console" />
|
||||||
|
</root>
|
||||||
|
|
||||||
|
</log4j:configuration>
|
|
@ -5,5 +5,8 @@ hibernate.connection.autocommit=true
|
||||||
jdbc.password=
|
jdbc.password=
|
||||||
|
|
||||||
hibernate.dialect=org.hibernate.dialect.H2Dialect
|
hibernate.dialect=org.hibernate.dialect.H2Dialect
|
||||||
hibernate.show_sql=true
|
|
||||||
|
# enable to see Hibernate generated SQL
|
||||||
|
hibernate.show_sql=false
|
||||||
|
|
||||||
hibernate.hbm2ddl.auto=create-drop
|
hibernate.hbm2ddl.auto=create-drop
|
|
@ -4,5 +4,7 @@ hibernate.connection.username=sa
|
||||||
hibernate.connection.autocommit=true
|
hibernate.connection.autocommit=true
|
||||||
hibernate.dialect=org.hibernate.dialect.H2Dialect
|
hibernate.dialect=org.hibernate.dialect.H2Dialect
|
||||||
|
|
||||||
hibernate.show_sql=true
|
# enable to see Hibernate generated SQL
|
||||||
|
hibernate.show_sql=false
|
||||||
|
|
||||||
hibernate.hbm2ddl.auto=create-drop
|
hibernate.hbm2ddl.auto=create-drop
|
|
@ -5,7 +5,10 @@ hibernate.connection.autocommit=true
|
||||||
jdbc.password=
|
jdbc.password=
|
||||||
|
|
||||||
hibernate.dialect=org.hibernate.dialect.H2Dialect
|
hibernate.dialect=org.hibernate.dialect.H2Dialect
|
||||||
hibernate.show_sql=true
|
|
||||||
|
# enable to see Hibernate generated SQL
|
||||||
|
hibernate.show_sql=false
|
||||||
|
|
||||||
hibernate.hbm2ddl.auto=create-drop
|
hibernate.hbm2ddl.auto=create-drop
|
||||||
|
|
||||||
hibernate.c3p0.min_size=5
|
hibernate.c3p0.min_size=5
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
|
||||||
|
<log4j:configuration debug="false" xmlns:log4j='http://jakarta.apache.org/log4j/'>
|
||||||
|
|
||||||
|
<appender name="console" class="org.apache.log4j.ConsoleAppender">
|
||||||
|
<layout class="org.apache.log4j.PatternLayout">
|
||||||
|
<param name="ConversionPattern"
|
||||||
|
value="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n" />
|
||||||
|
</layout>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<logger name="org.hibernate" additivity="false">
|
||||||
|
<level value="ERROR" />
|
||||||
|
<appender-ref ref="console" />
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<root>
|
||||||
|
<level value="INFO" />
|
||||||
|
<appender-ref ref="console" />
|
||||||
|
</root>
|
||||||
|
|
||||||
|
</log4j:configuration>
|
|
@ -5,7 +5,8 @@ hibernate.connection.autocommit=true
|
||||||
jdbc.password=
|
jdbc.password=
|
||||||
|
|
||||||
hibernate.dialect=org.hibernate.dialect.H2Dialect
|
hibernate.dialect=org.hibernate.dialect.H2Dialect
|
||||||
hibernate.show_sql=true
|
# enable to see Hibernate generated SQL
|
||||||
|
hibernate.show_sql=false
|
||||||
hibernate.hbm2ddl.auto=create-drop
|
hibernate.hbm2ddl.auto=create-drop
|
||||||
|
|
||||||
hibernate.c3p0.min_size=5
|
hibernate.c3p0.min_size=5
|
||||||
|
|
|
@ -5,5 +5,6 @@ hibernate.connection.autocommit=true
|
||||||
jdbc.password=
|
jdbc.password=
|
||||||
|
|
||||||
hibernate.dialect=org.hibernate.dialect.H2Dialect
|
hibernate.dialect=org.hibernate.dialect.H2Dialect
|
||||||
hibernate.show_sql=true
|
# enable to see Hibernate generated SQL
|
||||||
|
hibernate.show_sql=false
|
||||||
hibernate.hbm2ddl.auto=create-drop
|
hibernate.hbm2ddl.auto=create-drop
|
|
@ -5,7 +5,8 @@ hibernate.connection.autocommit=true
|
||||||
jdbc.password=
|
jdbc.password=
|
||||||
|
|
||||||
hibernate.dialect=org.hibernate.dialect.H2Dialect
|
hibernate.dialect=org.hibernate.dialect.H2Dialect
|
||||||
hibernate.show_sql=true
|
# enable to see Hibernate generated SQL
|
||||||
|
hibernate.show_sql=false
|
||||||
hibernate.hbm2ddl.auto=create-drop
|
hibernate.hbm2ddl.auto=create-drop
|
||||||
|
|
||||||
hibernate.c3p0.min_size=5
|
hibernate.c3p0.min_size=5
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
|
||||||
|
<log4j:configuration debug="false" xmlns:log4j='http://jakarta.apache.org/log4j/'>
|
||||||
|
|
||||||
|
<appender name="console" class="org.apache.log4j.ConsoleAppender">
|
||||||
|
<layout class="org.apache.log4j.PatternLayout">
|
||||||
|
<param name="ConversionPattern"
|
||||||
|
value="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n" />
|
||||||
|
</layout>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<logger name="org.hibernate" additivity="false">
|
||||||
|
<level value="ERROR" />
|
||||||
|
<appender-ref ref="console" />
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<root>
|
||||||
|
<level value="INFO" />
|
||||||
|
<appender-ref ref="console" />
|
||||||
|
</root>
|
||||||
|
|
||||||
|
</log4j:configuration>
|
|
@ -22,8 +22,9 @@ public class ArticleUnitTest {
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setup() {
|
public static void setup() {
|
||||||
Map<String, String> properties = new HashMap<>();
|
Map<String, String> properties = new HashMap<>();
|
||||||
properties.put("hibernate.show_sql", "true");
|
// set these to true to see Hibernate SQL
|
||||||
properties.put("hibernate.format_sql", "true");
|
properties.put("hibernate.show_sql", "false");
|
||||||
|
properties.put("hibernate.format_sql", "false");
|
||||||
emFactory = Persistence.createEntityManagerFactory("jpa-h2", properties);
|
emFactory = Persistence.createEntityManagerFactory("jpa-h2", properties);
|
||||||
em = emFactory.createEntityManager();
|
em = emFactory.createEntityManager();
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<property name="javax.persistence.jdbc.user" value="baeldung" />
|
<property name="javax.persistence.jdbc.user" value="baeldung" />
|
||||||
<property name="javax.persistence.jdbc.password" value="YourPassword" />
|
<property name="javax.persistence.jdbc.password" value="YourPassword" />
|
||||||
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
|
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
|
||||||
<property name="hibernate.show_sql" value="true" />
|
<property name="hibernate.show_sql" value="false" />
|
||||||
</properties>
|
</properties>
|
||||||
</persistence-unit>
|
</persistence-unit>
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
<property name="javax.persistence.jdbc.password" value="" />
|
<property name="javax.persistence.jdbc.password" value="" />
|
||||||
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" />
|
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" />
|
||||||
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
|
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
|
||||||
<property name="show_sql" value="true"/>
|
<property name="show_sql" value="false"/>
|
||||||
<property name="hibernate.temp.use_jdbc_metadata_defaults" value="false"/>
|
<property name="hibernate.temp.use_jdbc_metadata_defaults" value="false"/>
|
||||||
</properties>
|
</properties>
|
||||||
</persistence-unit>
|
</persistence-unit>
|
||||||
|
|
Loading…
Reference in New Issue