Merge pull request #14624 from timis1/JAVA-24160
JAVA-24160 Review log statements for projects - Week 33 - 2023
This commit is contained in:
commit
023d73ef61
|
@ -30,13 +30,13 @@ public class Java8ComparatorUnitTest {
|
||||||
System.out.println("************** Java 8 Comaparator **************");
|
System.out.println("************** Java 8 Comaparator **************");
|
||||||
Comparator<Player> byRanking = (Player player1, Player player2) -> Integer.compare(player1.getRanking(), player2.getRanking());
|
Comparator<Player> byRanking = (Player player1, Player player2) -> Integer.compare(player1.getRanking(), player2.getRanking());
|
||||||
|
|
||||||
System.out.println("Before Sorting : " + footballTeam);
|
|
||||||
Collections.sort(footballTeam, byRanking);
|
Collections.sort(footballTeam, byRanking);
|
||||||
System.out.println("After Sorting : " + footballTeam);
|
assertEquals(footballTeam.get(0).getName(), "Steven");
|
||||||
assertEquals(footballTeam.get(0)
|
assertEquals(footballTeam.get(0).getRanking(), 45);
|
||||||
.getName(), "Steven");
|
assertEquals(footballTeam.get(1).getName(), "John");
|
||||||
assertEquals(footballTeam.get(2)
|
assertEquals(footballTeam.get(1).getRanking(), 59);
|
||||||
.getRanking(), 67);
|
assertEquals(footballTeam.get(2).getName(), "Roger");
|
||||||
|
assertEquals(footballTeam.get(2).getRanking(), 67);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -45,24 +45,24 @@ public class Java8ComparatorUnitTest {
|
||||||
System.out.println("********* byRanking *********");
|
System.out.println("********* byRanking *********");
|
||||||
Comparator<Player> byRanking = Comparator.comparing(Player::getRanking);
|
Comparator<Player> byRanking = Comparator.comparing(Player::getRanking);
|
||||||
|
|
||||||
System.out.println("Before Sorting : " + footballTeam);
|
|
||||||
Collections.sort(footballTeam, byRanking);
|
Collections.sort(footballTeam, byRanking);
|
||||||
System.out.println("After Sorting : " + footballTeam);
|
assertEquals(footballTeam.get(0).getName(), "Steven");
|
||||||
assertEquals(footballTeam.get(0)
|
assertEquals(footballTeam.get(0).getRanking(), 45);
|
||||||
.getName(), "Steven");
|
assertEquals(footballTeam.get(1).getName(), "John");
|
||||||
assertEquals(footballTeam.get(2)
|
assertEquals(footballTeam.get(1).getRanking(), 59);
|
||||||
.getRanking(), 67);
|
assertEquals(footballTeam.get(2).getName(), "Roger");
|
||||||
|
assertEquals(footballTeam.get(2).getRanking(), 67);
|
||||||
|
|
||||||
System.out.println("********* byAge *********");
|
System.out.println("********* byAge *********");
|
||||||
Comparator<Player> byAge = Comparator.comparing(Player::getAge);
|
Comparator<Player> byAge = Comparator.comparing(Player::getAge);
|
||||||
|
|
||||||
System.out.println("Before Sorting : " + footballTeam);
|
|
||||||
Collections.sort(footballTeam, byAge);
|
Collections.sort(footballTeam, byAge);
|
||||||
System.out.println("After Sorting : " + footballTeam);
|
assertEquals(footballTeam.get(0).getName(), "Roger");
|
||||||
assertEquals(footballTeam.get(0)
|
assertEquals(footballTeam.get(0).getAge(), 20);
|
||||||
.getName(), "Roger");
|
assertEquals(footballTeam.get(1).getName(), "John");
|
||||||
assertEquals(footballTeam.get(2)
|
assertEquals(footballTeam.get(1).getAge(), 22);
|
||||||
.getRanking(), 45);
|
assertEquals(footballTeam.get(2).getName(), "Steven");
|
||||||
|
assertEquals(footballTeam.get(2).getAge(), 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,8 @@ eureka.client.registryFetchIntervalSeconds = 5
|
||||||
|
|
||||||
management.security.sessions=never
|
management.security.sessions=never
|
||||||
|
|
||||||
logging.level.org.springframework.web.=debug
|
logging.level.org.springframework.web.=INFO
|
||||||
logging.level.org.springframework.security=debug
|
logging.level.org.springframework.security=INFO
|
||||||
|
|
||||||
spring.redis.host=localhost
|
spring.redis.host=localhost
|
||||||
spring.redis.port=6379
|
spring.redis.port=6379
|
||||||
|
|
|
@ -6,8 +6,8 @@ eureka.client.registryFetchIntervalSeconds = 5
|
||||||
|
|
||||||
management.security.sessions=always
|
management.security.sessions=always
|
||||||
|
|
||||||
logging.level.org.springframework.web.=debug
|
logging.level.org.springframework.web.=INFO
|
||||||
logging.level.org.springframework.security=debug
|
logging.level.org.springframework.security=INFO
|
||||||
|
|
||||||
spring.redis.host=localhost
|
spring.redis.host=localhost
|
||||||
spring.redis.port=6379
|
spring.redis.port=6379
|
||||||
|
|
|
@ -10,8 +10,8 @@ eureka.client.registryFetchIntervalSeconds = 5
|
||||||
|
|
||||||
management.security.sessions=never
|
management.security.sessions=never
|
||||||
|
|
||||||
logging.level.org.springframework.web.=debug
|
logging.level.org.springframework.web.=INFO
|
||||||
logging.level.org.springframework.security=debug
|
logging.level.org.springframework.security=INFO
|
||||||
|
|
||||||
spring.redis.host=localhost
|
spring.redis.host=localhost
|
||||||
spring.redis.port=6379
|
spring.redis.port=6379
|
||||||
|
|
|
@ -4,4 +4,4 @@ server.port=9411
|
||||||
eureka.client.region = default
|
eureka.client.region = default
|
||||||
eureka.client.registryFetchIntervalSeconds = 5
|
eureka.client.registryFetchIntervalSeconds = 5
|
||||||
|
|
||||||
logging.level.org.springframework.web=debug
|
logging.level.org.springframework.web=INFO
|
||||||
|
|
|
@ -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>
|
|
@ -4,7 +4,7 @@ feign.okhttp.enabled=true
|
||||||
|
|
||||||
server.port=8085
|
server.port=8085
|
||||||
spring.main.allow-bean-definition-overriding=true
|
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
|
feign.hystrix.enabled=true
|
||||||
|
|
||||||
spring.cloud.openfeign.client.config.postClient.url=https://jsonplaceholder.typicode.com/posts/
|
spring.cloud.openfeign.client.config.postClient.url=https://jsonplaceholder.typicode.com/posts/
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
<logger name="org.springframework" level="ERROR"/>
|
<logger name="org.springframework" level="ERROR"/>
|
||||||
|
|
||||||
|
<logger name="org.springframework.integration.config" level="INFO"/>
|
||||||
|
|
||||||
<root level="INFO">
|
<root level="INFO">
|
||||||
<appender-ref ref="stdout" />
|
<appender-ref ref="stdout" />
|
||||||
</root>
|
</root>
|
||||||
|
|
Loading…
Reference in New Issue