* #496 Add pipeline module to parent pom ✨ * #496: Add main application class and test for pipeline * #496: Checkstyle format and add log messages on pipeline stages 🎨 * #496: Fill readme sections of pipeline ✨ * #496: Javadocs and checkstyle formatting 🎨 * #496: Follow PMD checks and add more explanation as block comment on App.java * #496: Apply requested PR changes by iluwatar 🎨 * #970: Replace log4j usage on commander pattern to Slf4j API 🎨 * #970: Replace log4j usage on dao pattern to Slf4j API 🎨 * #970: Replace log4j usage on data mapper pattern to Slf4j API 🎨 * #970: Remove log4j dependency on data transfer object pom 🔥 * #970: Replace log4j usage on module pattern to Slf4j API 🎨 * #970: Replace log4j usage on serverless pattern to Slf4j API 🎨 This also removes the aws log4j dependency * #970: Remove unnecessary gitignore line for log4j.xml 🔥 * #970: Remove remaining remnants of log4j 🔥 * #970: Replace System.out logging with appropriate logging methods 🎨 * #970: Replace System.out method references to Logger::info 🎨
This commit is contained in:
committed by
Ilkka Seppälä
parent
72b174619f
commit
cfdfedbd2e
@ -22,6 +22,9 @@
|
||||
*/
|
||||
package com.iluwatar.tls;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
@ -64,6 +67,8 @@ import java.util.concurrent.Future;
|
||||
* @author Thomas Bauer, 2017
|
||||
*/
|
||||
public class App {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(App.class);
|
||||
/**
|
||||
* Program entry point
|
||||
*
|
||||
@ -99,11 +104,11 @@ public class App {
|
||||
|
||||
// a correct run should deliver 20 times 15.12.2015
|
||||
// and a correct run shouldn't deliver any exception
|
||||
System.out.println("The List dateList contains " + counterDateValues + " date values");
|
||||
System.out.println("The List exceptionList contains " + counterExceptions + " exceptions");
|
||||
LOGGER.info("The List dateList contains " + counterDateValues + " date values");
|
||||
LOGGER.info("The List exceptionList contains " + counterExceptions + " exceptions");
|
||||
|
||||
} catch (Exception e) {
|
||||
System.out.println("Abnormal end of program. Program throws exception: " + e);
|
||||
LOGGER.info("Abnormal end of program. Program throws exception: " + e);
|
||||
}
|
||||
executor.shutdown();
|
||||
}
|
||||
@ -121,7 +126,7 @@ public class App {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(dt);
|
||||
// Formatted output of the date value: DD.MM.YYYY
|
||||
System.out.println(
|
||||
LOGGER.info(
|
||||
cal.get(Calendar.DAY_OF_MONTH) + "." + cal.get(Calendar.MONTH) + "." + +cal.get(Calendar.YEAR));
|
||||
}
|
||||
return counter;
|
||||
@ -138,7 +143,7 @@ public class App {
|
||||
int counter = 0;
|
||||
for (String ex : res.getExceptionList()) {
|
||||
counter++;
|
||||
System.out.println(ex);
|
||||
LOGGER.info(ex);
|
||||
}
|
||||
return counter;
|
||||
}
|
||||
|
@ -22,6 +22,9 @@
|
||||
*/
|
||||
package com.iluwatar.tls;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.concurrent.Callable;
|
||||
@ -40,6 +43,8 @@ import java.util.concurrent.Callable;
|
||||
* @author Thomas Bauer, 2017
|
||||
*/
|
||||
public class DateFormatCallable implements Callable<Result> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DateFormatCallable.class);
|
||||
// class variables (members)
|
||||
private ThreadLocal<DateFormat> df; //TLTL
|
||||
// private DateFormat df; //NTLNTL
|
||||
@ -72,7 +77,7 @@ public class DateFormatCallable implements Callable<Result> {
|
||||
*/
|
||||
@Override
|
||||
public Result call() {
|
||||
System.out.println(Thread.currentThread() + " started executing...");
|
||||
LOGGER.info(Thread.currentThread() + " started executing...");
|
||||
Result result = new Result();
|
||||
|
||||
// Convert date value to date 5 times
|
||||
@ -90,7 +95,7 @@ public class DateFormatCallable implements Callable<Result> {
|
||||
|
||||
}
|
||||
|
||||
System.out.println(Thread.currentThread() + " finished processing part of the thread");
|
||||
LOGGER.info(Thread.currentThread() + " finished processing part of the thread");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user