Merge pull request #14624 from timis1/JAVA-24160

JAVA-24160 Review log statements for projects - Week 33 - 2023
This commit is contained in:
Kasra Madadipouya 2023-08-20 23:33:04 +02:00 committed by GitHub
commit 023d73ef61
11 changed files with 95 additions and 27 deletions

View File

@ -30,13 +30,13 @@ public class Java8ComparatorUnitTest {
System.out.println("************** Java 8 Comaparator **************");
Comparator<Player> byRanking = (Player player1, Player player2) -> Integer.compare(player1.getRanking(), player2.getRanking());
System.out.println("Before Sorting : " + footballTeam);
Collections.sort(footballTeam, byRanking);
System.out.println("After Sorting : " + footballTeam);
assertEquals(footballTeam.get(0)
.getName(), "Steven");
assertEquals(footballTeam.get(2)
.getRanking(), 67);
assertEquals(footballTeam.get(0).getName(), "Steven");
assertEquals(footballTeam.get(0).getRanking(), 45);
assertEquals(footballTeam.get(1).getName(), "John");
assertEquals(footballTeam.get(1).getRanking(), 59);
assertEquals(footballTeam.get(2).getName(), "Roger");
assertEquals(footballTeam.get(2).getRanking(), 67);
}
@Test
@ -45,24 +45,24 @@ public class Java8ComparatorUnitTest {
System.out.println("********* byRanking *********");
Comparator<Player> byRanking = Comparator.comparing(Player::getRanking);
System.out.println("Before Sorting : " + footballTeam);
Collections.sort(footballTeam, byRanking);
System.out.println("After Sorting : " + footballTeam);
assertEquals(footballTeam.get(0)
.getName(), "Steven");
assertEquals(footballTeam.get(2)
.getRanking(), 67);
assertEquals(footballTeam.get(0).getName(), "Steven");
assertEquals(footballTeam.get(0).getRanking(), 45);
assertEquals(footballTeam.get(1).getName(), "John");
assertEquals(footballTeam.get(1).getRanking(), 59);
assertEquals(footballTeam.get(2).getName(), "Roger");
assertEquals(footballTeam.get(2).getRanking(), 67);
System.out.println("********* byAge *********");
Comparator<Player> byAge = Comparator.comparing(Player::getAge);
System.out.println("Before Sorting : " + footballTeam);
Collections.sort(footballTeam, byAge);
System.out.println("After Sorting : " + footballTeam);
assertEquals(footballTeam.get(0)
.getName(), "Roger");
assertEquals(footballTeam.get(2)
.getRanking(), 45);
assertEquals(footballTeam.get(0).getName(), "Roger");
assertEquals(footballTeam.get(0).getAge(), 20);
assertEquals(footballTeam.get(1).getName(), "John");
assertEquals(footballTeam.get(1).getAge(), 22);
assertEquals(footballTeam.get(2).getName(), "Steven");
assertEquals(footballTeam.get(2).getAge(), 24);
}
}

View File

@ -10,8 +10,8 @@ eureka.client.registryFetchIntervalSeconds = 5
management.security.sessions=never
logging.level.org.springframework.web.=debug
logging.level.org.springframework.security=debug
logging.level.org.springframework.web.=INFO
logging.level.org.springframework.security=INFO
spring.redis.host=localhost
spring.redis.port=6379

View File

@ -6,8 +6,8 @@ eureka.client.registryFetchIntervalSeconds = 5
management.security.sessions=always
logging.level.org.springframework.web.=debug
logging.level.org.springframework.security=debug
logging.level.org.springframework.web.=INFO
logging.level.org.springframework.security=INFO
spring.redis.host=localhost
spring.redis.port=6379

View File

@ -10,8 +10,8 @@ eureka.client.registryFetchIntervalSeconds = 5
management.security.sessions=never
logging.level.org.springframework.web.=debug
logging.level.org.springframework.security=debug
logging.level.org.springframework.web.=INFO
logging.level.org.springframework.security=INFO
spring.redis.host=localhost
spring.redis.port=6379

View File

@ -4,4 +4,4 @@ server.port=9411
eureka.client.region = default
eureka.client.registryFetchIntervalSeconds = 5
logging.level.org.springframework.web=debug
logging.level.org.springframework.web=INFO

View File

@ -0,0 +1,17 @@
<?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>
<logger name="com.netflix.config" level="WARN"/>
<logger name="org.springframework.boot.test.context" level="WARN"/>
<root level="INFO">
<appender-ref ref="STDOUT" />
</root>
</configuration>

View File

@ -4,7 +4,7 @@ feign.okhttp.enabled=true
server.port=8085
spring.main.allow-bean-definition-overriding=true
logging.level.com.baeldung.cloud.openfeign.client=DEBUG
logging.level.com.baeldung.cloud.openfeign.client=INFO
feign.hystrix.enabled=true
spring.cloud.openfeign.client.config.postClient.url=https://jsonplaceholder.typicode.com/posts/

View File

@ -0,0 +1,17 @@
<?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>
<logger name="org.springframework.boot.test.context" level="WARN"/>
<logger name="org.springframework.test.context.support" level="WARN"/>
<root level="INFO">
<appender-ref ref="STDOUT" />
</root>
</configuration>

View File

@ -0,0 +1,15 @@
<?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>
<logger name="org.springframework.boot.test.context" level="WARN"/>
<root level="INFO">
<appender-ref ref="STDOUT" />
</root>
</configuration>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
# Pattern of log message for console appender
<Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</Pattern>
</layout>
</appender>
<logger name="org.springframework.boot.test.context" level="WARN"/>
<logger name="org.springframework.boot.test.autoconfigure.web.servlet" level="WARN"/>
<root level="INFO">
<appender-ref ref="stdout" />
</root>
</configuration>

View File

@ -9,6 +9,8 @@
<logger name="org.springframework" level="ERROR"/>
<logger name="org.springframework.integration.config" level="INFO"/>
<root level="INFO">
<appender-ref ref="stdout" />
</root>