Se agrego informacion de logeo a SQLiteCajaDAO
This commit is contained in:
@@ -33,8 +33,11 @@ import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
public class SQLiteCajaDAO implements CajaDAO {
|
||||
private static final Logger LOGGER = LogManager.getLogger(SQLiteCajaDAO.class);
|
||||
private SQLiteConnectionHolder connectionHolder;
|
||||
|
||||
public SQLiteCajaDAO() {
|
||||
@@ -58,6 +61,7 @@ public class SQLiteCajaDAO implements CajaDAO {
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
LOGGER.error("Error al intentar obtener todas las Cajas", e);
|
||||
}
|
||||
|
||||
return cajaList;
|
||||
@@ -80,6 +84,7 @@ public class SQLiteCajaDAO implements CajaDAO {
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
LOGGER.error("Error al intentar conseguir la caja con id " + id, e);
|
||||
}
|
||||
return Optional.ofNullable(caja);
|
||||
}
|
||||
@@ -101,6 +106,7 @@ public class SQLiteCajaDAO implements CajaDAO {
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
LOGGER.error("Error al intentar conseguir la caja con fecha " + fecha, e);
|
||||
}
|
||||
return Optional.ofNullable(caja);
|
||||
}
|
||||
@@ -115,7 +121,6 @@ public class SQLiteCajaDAO implements CajaDAO {
|
||||
ps.executeUpdate();
|
||||
}
|
||||
|
||||
query = "select last_insert_rowid()";
|
||||
try (PreparedStatement ps = conn.prepareStatement("select last_insert_rowid()")) {
|
||||
try (ResultSet rs = ps.executeQuery()) {
|
||||
rs.next();
|
||||
@@ -124,6 +129,7 @@ public class SQLiteCajaDAO implements CajaDAO {
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
LOGGER.error("Error al intentar insertar la caja " + caja, e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,6 +144,7 @@ public class SQLiteCajaDAO implements CajaDAO {
|
||||
ps.executeUpdate();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
LOGGER.error("Error al intentar actualizar la caja " + caja, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,13 +6,21 @@ filters = threshold
|
||||
filter.threshold.type = ThresholdFilter
|
||||
filter.threshold.level = debug
|
||||
|
||||
appenders = console
|
||||
appenders = console, file
|
||||
|
||||
appender.console.type = Console
|
||||
appender.console.name = STDOUT
|
||||
appender.console.name = console
|
||||
appender.console.layout.type = PatternLayout
|
||||
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
|
||||
appender.console.layout.pattern = %date{yyyy-MM-dd HH:mm:ss} [%level] [%logger{3}:%line] - %message %n
|
||||
|
||||
appender.file.type = File
|
||||
appender.file.name = file
|
||||
appender.file.fileName = logs/debug.log
|
||||
appender.file.layout.type = PatternLayout
|
||||
appender.file.layout.pattern = %date{yyyy-MM-dd HH:mm:ss} [%level] [%logger{3}:%line] - %message %n
|
||||
|
||||
rootLogger.level = debug
|
||||
rootLogger.appenderRefs = stdout
|
||||
rootLogger.appenderRef.stdout.ref = STDOUT
|
||||
rootLogger.additivity = false
|
||||
rootLogger.appenderRefs = console, file
|
||||
rootLogger.appenderRef.stdout.ref = console
|
||||
rootLogger.appenderRef.rolling.ref = file
|
||||
|
||||
Reference in New Issue
Block a user