#970 single logging framework should be enforced (#982)

* #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:
Joshua Jimenez
2019-10-14 04:41:11 +08:00
committed by Ilkka Seppälä
parent 72b174619f
commit cfdfedbd2e
50 changed files with 163 additions and 410 deletions
+5 -4
View File
@@ -31,8 +31,9 @@ import java.util.stream.Stream;
import javax.sql.DataSource;
import org.apache.log4j.Logger;
import org.h2.jdbcx.JdbcDataSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Data Access Object (DAO) is an object that provides an abstract interface to some type of
@@ -50,7 +51,7 @@ import org.h2.jdbcx.JdbcDataSource;
*/
public class App {
private static final String DB_URL = "jdbc:h2:~/dao";
private static Logger log = Logger.getLogger(App.class);
private static Logger log = LoggerFactory.getLogger(App.class);
private static final String ALL_CUSTOMERS = "customerDao.getAllCustomers(): ";
/**
@@ -94,7 +95,7 @@ public class App {
addCustomers(customerDao);
log.info(ALL_CUSTOMERS);
try (Stream<Customer> customerStream = customerDao.getAll()) {
customerStream.forEach((customer) -> log.info(customer));
customerStream.forEach((customer) -> log.info(customer.toString()));
}
log.info("customerDao.getCustomerById(2): " + customerDao.getById(2));
final Customer customer = new Customer(4, "Dan", "Danson");
@@ -105,7 +106,7 @@ public class App {
customerDao.update(customer);
log.info(ALL_CUSTOMERS);
try (Stream<Customer> customerStream = customerDao.getAll()) {
customerStream.forEach((cust) -> log.info(cust));
customerStream.forEach((cust) -> log.info(cust.toString()));
}
customerDao.delete(customer);
log.info(ALL_CUSTOMERS + customerDao.getAll());
@@ -22,6 +22,9 @@
*/
package com.iluwatar.dao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@@ -35,15 +38,13 @@ import java.util.stream.StreamSupport;
import javax.sql.DataSource;
import org.apache.log4j.Logger;
/**
* An implementation of {@link CustomerDao} that persists customers in RDBMS.
*
*/
public class DbCustomerDao implements CustomerDao {
private static final Logger LOGGER = Logger.getLogger(DbCustomerDao.class);
private static final Logger LOGGER = LoggerFactory.getLogger(DbCustomerDao.class);
private final DataSource dataSource;