这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions apache-poi-3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@
<artifactId>jmh-generator-annprocess</artifactId>
<version>${jmh.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j.version}</version>
</dependency>
</dependencies>

<properties>
Expand All @@ -102,6 +107,7 @@
<logback-classic.version>1.5.6</logback-classic.version>
<logback-core.version>1.5.6</logback-core.version>
<jmh.version>1.37</jmh.version>
<log4j.version>2.23.1</log4j.version>
</properties>

</project>
10 changes: 8 additions & 2 deletions apache-poi-4/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,21 @@
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${logback-core.version}</version>
</dependency>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j.version}</version>
</dependency>
</dependencies>

<properties>
<poi.version>5.3.0</poi.version>
<poi-ooxml-schemas.version>4.1.2</poi-ooxml-schemas.version>
<xmlbeans.version>5.2.0</xmlbeans.version>
<logback-classic.version>1.5.6</logback-classic.version>
<logback-core.version>1.5.6</logback-core.version>
<logback-core.version>1.5.6</logback-core.version>
<log4j.version>2.23.1</log4j.version>
</properties>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
import java.util.Collection;
import java.util.Date;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class DatesCollectionIteration {
private static final Logger log = LoggerFactory.getLogger(DatesCollectionIteration.class);

public void iteratingRangeOfDatesJava7(Collection<Date> dates) {

Expand All @@ -18,7 +22,7 @@ public void iteratingRangeOfDatesJava8(Collection<Date> dates) {
}

private void processDate(Date date) {
System.out.println(date);
log.debug(date.toString());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
import java.util.Calendar;
import java.util.Date;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class RangeDatesIteration {
private static final Logger log = LoggerFactory.getLogger(RangeDatesIteration.class);

public void iterateBetweenDatesJava9(LocalDate startDate, LocalDate endDate) {

Expand Down Expand Up @@ -34,10 +38,10 @@ public void iterateBetweenDatesJava7(Date start, Date end) {
}

private void processDate(LocalDate date) {
System.out.println(date);
log.debug(date.toString());
}

private void processDate(Date date) {
System.out.println(date);
log.debug(date.toString());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void givenStringArrayWithInvalidNum_whenUseStreamApi_shouldGetExpectedIntArray()
try {
return Integer.parseInt(s);
} catch (NumberFormatException ex) {
logger.warn("Invalid number format detected: {}, use Int.MinValue as the fallback", s);
logger.debug("Invalid number format detected: {}, use Int.MinValue as the fallback", s);
return Integer.MIN_VALUE;
}
}).toArray();
Expand All @@ -53,7 +53,7 @@ void givenStringArrayWithInvalidNum_whenConvertInLoop_shouldGetExpectedIntArray(
try {
result[i] = Integer.parseInt(stringArrayWithInvalidNum[i]);
} catch (NumberFormatException exception) {
logger.warn("Invalid number format detected: [{}], use Int.MinValue as the fallback", stringArrayWithInvalidNum[i]);
logger.debug("Invalid number format detected: [{}], use Int.MinValue as the fallback", stringArrayWithInvalidNum[i]);
result[i] = Integer.MIN_VALUE;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<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.apache.flink" level="ERROR"/>
<logger name="org.apache.kafka" level="ERROR"/>

<root level="INFO">
<appender-ref ref="STDOUT" />
</root>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public static Consumer<Integer> lambdaWrapper(Consumer<Integer> consumer) {
try {
consumer.accept(i);
} catch (ArithmeticException e) {
LOGGER.error("Arithmetic Exception occurred.", e);
LOGGER.error("Arithmetic Exception occurred : {}", e.getMessage());
}
};
}
Expand All @@ -26,7 +26,7 @@ static <T, E extends Exception> Consumer<T> consumerWrapper(Consumer<T> consumer
} catch (Exception ex) {
try {
E exCast = clazz.cast(ex);
LOGGER.error("Exception occurred.", exCast);
LOGGER.error("Exception occurred : {}", exCast.getMessage());
} catch (ClassCastException ccEx) {
throw ex;
}
Expand All @@ -51,7 +51,7 @@ public static <T, E extends Exception> Consumer<T> handlingConsumerWrapper(Throw
} catch (Exception ex) {
try {
E exCast = exceptionClass.cast(ex);
LOGGER.error("Exception occurred.", exCast);
LOGGER.error("Exception occurred : {}", exCast.getMessage());
} catch (ClassCastException ccEx) {
throw new RuntimeException(ex);
}
Expand Down