logback-dev
Threads by month
- ----- 2025 -----
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
March 2010
- 11 participants
- 188 discussions

[GIT] Logback: the generic, reliable, fast and flexible logging framework. branch, master, updated. v0.9.18-114-gcc1540f
by git-noreply@pixie.qos.ch 23 Mar '10
by git-noreply@pixie.qos.ch 23 Mar '10
23 Mar '10
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Logback: the generic, reliable, fast and flexible logging framework.".
The branch, master has been updated
via cc1540f6a907d3f366cc1acbafc6056824b89875 (commit)
from 2181956a1dae32a14218f9da2d844e8913bb218e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=cc1540f6a907d3f366cc1acb…
http://github.com/ceki/logback/commit/cc1540f6a907d3f366cc1acbafc6056824b89…
commit cc1540f6a907d3f366cc1acbafc6056824b89875
Author: Ceki Gulcu <ceki(a)qos.ch>
Date: Tue Mar 23 23:51:48 2010 +0100
- table and col names converted to lower case
- tests pass for PostgreSQL, Oracle 10, MySQL, H2, HSQL
diff --git a/logback-access/src/main/java/ch/qos/logback/access/db/dialect/hsqldb.sql b/logback-access/src/main/java/ch/qos/logback/access/db/dialect/hsqldb.sql
index c82b677..714630c 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/db/dialect/hsqldb.sql
+++ b/logback-access/src/main/java/ch/qos/logback/access/db/dialect/hsqldb.sql
@@ -17,11 +17,11 @@ CREATE TABLE access_event (
method VARCHAR(254),
serverName VARCHAR(254),
postContent VARCHAR(254),
- event_id INT NOT NULL IDENTITY);
+ event_id BIGINT NOT NULL IDENTITY);
CREATE TABLE access_event_header (
- event_id INT NOT NULL,
+ event_id BIGINT NOT NULL,
header_key VARCHAR(254) NOT NULL,
header_value LONGVARCHAR,
PRIMARY KEY(event_id, header_key),
diff --git a/logback-access/src/main/java/ch/qos/logback/access/db/dialect/mysql.sql b/logback-access/src/main/java/ch/qos/logback/access/db/dialect/mysql.sql
index 6c6a055..70bb9f6 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/db/dialect/mysql.sql
+++ b/logback-access/src/main/java/ch/qos/logback/access/db/dialect/mysql.sql
@@ -10,10 +10,10 @@ DROP TABLE IF EXISTS access_event;
COMMIT;
BEGIN;
-CREATE TABLE access_event
+CREATE TABLE ACCESS_EVENT
(
timestmp BIGINT NOT NULL,
- requestURI VARCHAR(254),
+ requestURI VARCHAR(254),
requestURL VARCHAR(254),
remoteHost VARCHAR(254),
remoteUser VARCHAR(254),
@@ -22,14 +22,14 @@ CREATE TABLE access_event
method VARCHAR(254),
serverName VARCHAR(254),
postContent VARCHAR(254),
- event_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY
+ event_id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY
);
COMMIT;
BEGIN;
CREATE TABLE access_event_header
(
- event_id INT NOT NULL,
+ event_id BIGINT NOT NULL,
header_key VARCHAR(254) NOT NULL,
header_value VARCHAR(1024),
PRIMARY KEY(event_id, header_key),
diff --git a/logback-access/src/main/java/ch/qos/logback/access/db/dialect/oracle.sql b/logback-access/src/main/java/ch/qos/logback/access/db/dialect/oracle.sql
index a41ac46..9533d1e 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/db/dialect/oracle.sql
+++ b/logback-access/src/main/java/ch/qos/logback/access/db/dialect/oracle.sql
@@ -9,7 +9,7 @@ CREATE SEQUENCE access_event_id_seq MINVALUE 1 START WITH 1;
CREATE TABLE access_event
(
timestmp NUMBER(20) NOT NULL,
- requestURI VARCHAR(254),
+ requestURI VARCHAR(254),
requestURL VARCHAR(254),
remoteHost VARCHAR(254),
remoteUser VARCHAR(254),
@@ -18,7 +18,7 @@ CREATE TABLE access_event
method VARCHAR(254),
serverName VARCHAR(254),
postContent VARCHAR(254),
- event_id NUMBER(10) PRIMARY KEY
+ event_id NUMBER(20) PRIMARY KEY
);
-- the / suffix may or may not be needed depending on your SQL Client
@@ -38,7 +38,7 @@ CREATE TRIGGER access_event_id_seq_trig
CREATE TABLE access_event_header
(
- event_id NUMBER(10) NOT NULL,
+ event_id NUMBER(20) NOT NULL,
header_key VARCHAR2(254) NOT NULL,
header_value VARCHAR2(1024),
PRIMARY KEY(event_id, header_key),
diff --git a/logback-access/src/main/java/ch/qos/logback/access/db/dialect/postgresql.sql b/logback-access/src/main/java/ch/qos/logback/access/db/dialect/postgresql.sql
index 00e4af1..ba5cce7 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/db/dialect/postgresql.sql
+++ b/logback-access/src/main/java/ch/qos/logback/access/db/dialect/postgresql.sql
@@ -11,7 +11,7 @@ CREATE SEQUENCE access_event_id_seq MINVALUE 1 START 1;
CREATE TABLE access_event
(
timestmp BIGINT NOT NULL,
- requestURI VARCHAR(254),
+ requestURI VARCHAR(254),
requestURL VARCHAR(254),
remoteHost VARCHAR(254),
remoteUser VARCHAR(254),
@@ -20,12 +20,12 @@ CREATE TABLE access_event
method VARCHAR(254),
serverName VARCHAR(254),
postContent VARCHAR(254),
- event_id INT DEFAULT nextval('access_event_id_seq') PRIMARY KEY
+ event_id BIGINT DEFAULT nextval('access_event_id_seq') PRIMARY KEY
);
CREATE TABLE access_event_header
(
- event_id INT NOT NULL,
+ event_id BIGINT NOT NULL,
header_key VARCHAR(254) NOT NULL,
header_value VARCHAR(1024),
PRIMARY KEY(event_id, header_key),
diff --git a/logback-access/src/test/input/integration/db/postgresql-with-driver.xml b/logback-access/src/test/input/integration/db/postgresql-with-driver.xml
index 8b047ab..34fc95c 100644
--- a/logback-access/src/test/input/integration/db/postgresql-with-driver.xml
+++ b/logback-access/src/test/input/integration/db/postgresql-with-driver.xml
@@ -2,15 +2,15 @@
<configuration>
- <appender name="DB" class="ch.qos.logback.access.db.DBAppender">
- <connectionSource class="ch.qos.logback.core.db.DriverManagerConnectionSource">
- <driverClass>org.postgresql.Driver</driverClass>
- <url>jdbc:postgresql://192.168.1.5:5432/test</url>
- <user>logback</user>
- <password>logback</password>
- </connectionSource>
- </appender>
+ <appender name="DB" class="ch.qos.logback.access.db.DBAppender">
+ <connectionSource class="ch.qos.logback.core.db.DriverManagerConnectionSource">
+ <driverClass>org.postgresql.Driver</driverClass>
+ <url>jdbc:postgresql://192.168.1.5:5432/test</url>
+ <user>logback</user>
+ <password>logback</password>
+ </connectionSource>
+ </appender>
- <appender-ref ref="DB" />
+ <appender-ref ref="DB" />
</configuration>
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/db/DBAppender.java b/logback-classic/src/main/java/ch/qos/logback/classic/db/DBAppender.java
index 68c398f..b0c298a 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/db/DBAppender.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/db/DBAppender.java
@@ -95,8 +95,6 @@ public class DBAppender extends DBAppenderBase<ILoggingEvent> {
}
long eventId = selectEventId(insertStatement, connection);
-
- System.out.println("eventId"+eventId);
Map<String, String> mergedMap = mergePropertyMaps(event);
insertProperties(mergedMap, connection, eventId);
@@ -248,7 +246,6 @@ public class DBAppender extends DBAppenderBase<ILoggingEvent> {
if (cnxSupportsBatchUpdates) {
exceptionStatement.executeBatch();
- System.out.println("executin batch");
}
exceptionStatement.close();
exceptionStatement = null;
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/h2.sql b/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/h2.sql
index f8660c0..f053863 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/h2.sql
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/h2.sql
@@ -3,34 +3,34 @@
# It is intended for H2 databases.
-DROP TABLE LOGGING_EVENT_EXCEPTION IF EXISTSu;
-DROP TABLE LOGGING_EVENT_PROPERTY IF EXISTS;
-DROP TABLE LOGGING_EVENT IF EXISTS;
+DROP TABLE logging_event_exception IF EXISTSu;
+DROP TABLE logging_event_property IF EXISTS;
+DROP TABLE logging_event IF EXISTS;
-CREATE TABLE LOGGING_EVENT (
- TIMESTMP BIGINT NOT NULL,
- FORMATTED_MESSAGE LONGVARCHAR NOT NULL,
- LOGGER_NAME VARCHAR(256) NOT NULL,
- LEVEL_STRING VARCHAR(256) NOT NULL,
- THREAD_NAME VARCHAR(256),
- REFERENCE_FLAG SMALLINT,
- CALLER_FILENAME VARCHAR(256),
- CALLER_CLASS VARCHAR(256),
- CALLER_METHOD VARCHAR(256),
- CALLER_LINE CHAR(4),
- EVENT_ID IDENTITY NOT NULL);
+CREATE TABLE logging_event (
+ timestmp BIGINT NOT NULL,
+ formatted_message LONGVARCHAR NOT NULL,
+ logger_name VARCHAR(256) NOT NULL,
+ level_string VARCHAR(256) NOT NULL,
+ thread_name VARCHAR(256),
+ reference_flag SMALLINT,
+ caller_filename VARCHAR(256),
+ caller_class VARCHAR(256),
+ caller_method VARCHAR(256),
+ caller_line CHAR(4),
+ event_id IDENTITY NOT NULL);
-CREATE TABLE LOGGING_EVENT_PROPERTY (
- EVENT_ID BIGINT NOT NULL,
- MAPPED_KEY VARCHAR(254) NOT NULL,
- MAPPED_VALUE LONGVARCHAR,
- PRIMARY KEY(EVENT_ID, MAPPED_KEY),
- FOREIGN KEY (EVENT_ID) REFERENCES LOGGING_EVENT(EVENT_ID));
+CREATE TABLE logging_event_property (
+ event_id BIGINT NOT NULL,
+ mapped_key VARCHAR(254) NOT NULL,
+ mapped_value LONGVARCHAR,
+ PRIMARY KEY(event_id, mapped_key),
+ FOREIGN KEY (event_id) REFERENCES logging_event(event_id));
-CREATE TABLE LOGGING_EVENT_EXCEPTION (
- EVENT_ID BIGINT NOT NULL,
- I SMALLINT NOT NULL,
- TRACE_LINE VARCHAR(256) NOT NULL,
- PRIMARY KEY(EVENT_ID, I),
- FOREIGN KEY (EVENT_ID) REFERENCES LOGGING_EVENT(EVENT_ID));
+CREATE TABLE logging_event_exception (
+ event_id BIGINT NOT NULL,
+ i SMALLINT NOT NULL,
+ trace_line VARCHAR(256) NOT NULL,
+ PRIMARY KEY(event_id, i),
+ FOREIGN KEY (event_id) REFERENCES logging_event(event_id));
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/hsqldb.sql b/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/hsqldb.sql
index e308f34..07cf847 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/hsqldb.sql
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/hsqldb.sql
@@ -2,34 +2,34 @@
#
# It is intended for HSQL databases. It has been tested on HSQL 1.8.07.
-DROP TABLE LOGGING_EVENT_EXCEPTION IF EXISTSu;
-DROP TABLE LOGGING_EVENT_PROPERTY IF EXISTS;
-DROP TABLE LOGGING_EVENT IF EXISTS;
+DROP TABLE logging_event_exception IF EXISTS;
+DROP TABLE logging_event_property IF EXISTS;
+DROP TABLE logging_event IF EXISTS;
-CREATE TABLE LOGGING_EVENT (
- TIMESTMP BIGINT NOT NULL,
- FORMATTED_MESSAGE LONGVARCHAR NOT NULL,
- LOGGER_NAME VARCHAR(256) NOT NULL,
- LEVEL_STRING VARCHAR(256) NOT NULL,
- THREAD_NAME VARCHAR(256),
- REFERENCE_FLAG SMALLINT,
- CALLER_FILENAME VARCHAR(256),
- CALLER_CLASS VARCHAR(256),
- CALLER_METHOD VARCHAR(256),
- CALLER_LINE CHAR(4),
- EVENT_ID BIGINT NOT NULL IDENTITY);
+CREATE TABLE logging_event (
+ timestmp BIGINT NOT NULL,
+ formatted_message LONGVARCHAR NOT NULL,
+ logger_name VARCHAR(256) NOT NULL,
+ level_string VARCHAR(256) NOT NULL,
+ thread_name VARCHAR(256),
+ reference_flag SMALLINT,
+ caller_filename VARCHAR(256),
+ caller_class VARCHAR(256),
+ caller_method VARCHAR(256),
+ caller_line CHAR(4),
+ event_id BIGINT NOT NULL IDENTITY);
-CREATE TABLE LOGGING_EVENT_PROPERTY (
- EVENT_ID BIGINT NOT NULL,
- MAPPED_KEY VARCHAR(254) NOT NULL,
- MAPPED_VALUE LONGVARCHAR,
- PRIMARY KEY(EVENT_ID, MAPPED_KEY),
- FOREIGN KEY (EVENT_ID) REFERENCES LOGGING_EVENT(EVENT_ID));
+CREATE TABLE logging_event_property (
+ event_id BIGINT NOT NULL,
+ mapped_key VARCHAR(254) NOT NULL,
+ mapped_value LONGVARCHAR,
+ PRIMARY KEY(event_id, mapped_key),
+ FOREIGN KEY (event_id) REFERENCES logging_event(event_id));
-CREATE TABLE LOGGING_EVENT_EXCEPTION (
- EVENT_ID BIGINT NOT NULL,
- I SMALLINT NOT NULL,
- TRACE_LINE VARCHAR(256) NOT NULL,
- PRIMARY KEY(EVENT_ID, I),
- FOREIGN KEY (EVENT_ID) REFERENCES LOGGING_EVENT(EVENT_ID));
\ No newline at end of file
+CREATE TABLE logging_event_exception (
+ event_id BIGINT NOT NULL,
+ i SMALLINT NOT NULL,
+ trace_line VARCHAR(256) NOT NULL,
+ PRIMARY KEY(event_id, i),
+ FOREIGN KEY (event_id) REFERENCES logging_event(event_id));
\ No newline at end of file
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/mysql.sql b/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/mysql.sql
index e8c2fb3..5195dcf 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/mysql.sql
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/mysql.sql
@@ -5,47 +5,47 @@
BEGIN;
-DROP TABLE IF EXISTS LOGGING_EVENT_PROPERTY;
-DROP TABLE IF EXISTS LOGGING_EVENT_EXCEPTION;
-DROP TABLE IF EXISTS LOGGING_EVENT;
+DROP TABLE IF EXISTS logging_event_property;
+DROP TABLE IF EXISTS logging_event_exception;
+DROP TABLE IF EXISTS logging_event;
COMMIT;
BEGIN;
-CREATE TABLE LOGGING_EVENT
+CREATE TABLE logging_event
(
- TIMESTMP BIGINT NOT NULL,
- FORMATTED_MESSAGE TEXT NOT NULL,
- LOGGER_NAME VARCHAR(254) NOT NULL,
- LEVEL_STRING VARCHAR(254) NOT NULL,
- THREAD_NAME VARCHAR(254),
- REFERENCE_FLAG SMALLINT,
- CALLER_FILENAME VARCHAR(254) NOT NULL,
- CALLER_CLASS VARCHAR(254) NOT NULL,
- CALLER_METHOD VARCHAR(254) NOT NULL,
- CALLER_LINE CHAR(4) NOT NULL,
- EVENT_ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY
+ timestmp BIGINT NOT NULL,
+ formatted_message TEXT NOT NULL,
+ logger_name VARCHAR(254) NOT NULL,
+ level_string VARCHAR(254) NOT NULL,
+ thread_name VARCHAR(254),
+ reference_flag SMALLINT,
+ caller_filename VARCHAR(254) NOT NULL,
+ caller_class VARCHAR(254) NOT NULL,
+ caller_method VARCHAR(254) NOT NULL,
+ caller_line CHAR(4) NOT NULL,
+ event_id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY
);
COMMIT;
BEGIN;
-CREATE TABLE LOGGING_EVENT_PROPERTY
+CREATE TABLE logging_event_property
(
- EVENT_ID INT NOT NULL,
- MAPPED_KEY VARCHAR(254) NOT NULL,
- MAPPED_VALUE TEXT,
- PRIMARY KEY(EVENT_ID, MAPPED_KEY),
- FOREIGN KEY (EVENT_ID) REFERENCES LOGGING_EVENT(EVENT_ID)
+ event_id BIGINT NOT NULL,
+ mapped_key VARCHAR(254) NOT NULL,
+ mapped_value TEXT,
+ PRIMARY KEY(event_id, mapped_key),
+ FOREIGN KEY (event_id) REFERENCES logging_event(event_id)
);
COMMIT;
BEGIN;
-CREATE TABLE LOGGING_EVENT_EXCEPTION
+CREATE TABLE logging_event_exception
(
- EVENT_ID INT NOT NULL,
- I SMALLINT NOT NULL,
- TRACE_LINE VARCHAR(254) NOT NULL,
- PRIMARY KEY(EVENT_ID, I),
- FOREIGN KEY (EVENT_ID) REFERENCES LOGGING_EVENT(EVENT_ID)
+ event_id BIGINT NOT NULL,
+ i SMALLINT NOT NULL,
+ trace_line VARCHAR(254) NOT NULL,
+ PRIMARY KEY(event_id, i),
+ FOREIGN KEY (event_id) REFERENCES logging_event(event_id)
);
COMMIT;
\ No newline at end of file
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/oracle.sql b/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/oracle.sql
index 9ac0b79..89e244e 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/oracle.sql
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/oracle.sql
@@ -13,7 +13,7 @@
CREATE SEQUENCE logging_event_id_seq MINVALUE 1 START WITH 1;
-CREATE SEQUENCE logging_event_id_seq MINVALUE 1 START WITH 1;
+
CREATE TABLE logging_event
(
timestmp NUMBER(20) NOT NULL,
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/postgresql.sql b/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/postgresql.sql
index 55c7343..25a3dd1 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/postgresql.sql
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/postgresql.sql
@@ -14,7 +14,7 @@ CREATE SEQUENCE logging_event_id_seq MINVALUE 1 START 1;
CREATE TABLE logging_event
(
timestmp BIGINT NOT NULL,
- formatted_message TEXT NOT NULL,
+ formatted_message TEXT NOT NULL,
logger_name VARCHAR(254) NOT NULL,
level_string VARCHAR(254) NOT NULL,
thread_name VARCHAR(254),
@@ -23,12 +23,12 @@ CREATE TABLE logging_event
caller_class VARCHAR(254) NOT NULL,
caller_method VARCHAR(254) NOT NULL,
caller_line CHAR(4) NOT NULL,
- event_id INT DEFAULT nextval('logging_event_id_seq') PRIMARY KEY
+ event_id BIGINT DEFAULT nextval('logging_event_id_seq') PRIMARY KEY
);
CREATE TABLE logging_event_property
(
- event_id INT NOT NULL,
+ event_id BIGINT NOT NULL,
mapped_key VARCHAR(254) NOT NULL,
mapped_value VARCHAR(1024),
PRIMARY KEY(event_id, mapped_key),
@@ -37,7 +37,7 @@ CREATE TABLE logging_event_property
CREATE TABLE logging_event_exception
(
- event_id INT NOT NULL,
+ event_id BIGINT NOT NULL,
i SMALLINT NOT NULL,
trace_line VARCHAR(254) NOT NULL,
PRIMARY KEY(event_id, i),
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/db/names/DefaultDBNameResolver.java b/logback-classic/src/main/java/ch/qos/logback/classic/db/names/DefaultDBNameResolver.java
index db88a52..e7ce6c8 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/db/names/DefaultDBNameResolver.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/db/names/DefaultDBNameResolver.java
@@ -14,17 +14,21 @@
package ch.qos.logback.classic.db.names;
/**
+ * The default name resolver simply returns the enum passes as parameter
+ * as a lower case string.
+ *
* @author Tomasz Nurkiewicz
- * @since 2010-03-16
+ * @author Ceki Gulcu
+ * @since 0.9.19
*/
public class DefaultDBNameResolver implements DBNameResolver {
public <N extends Enum<?>> String getTableName(N tableName) {
- return tableName.toString();
+ return tableName.toString().toLowerCase();
}
public <N extends Enum<?>> String getColumnName(N columnName) {
- return columnName.toString();
+ return columnName.toString().toLowerCase();
}
}
diff --git a/logback-classic/src/test/input/integration/db/postgresql-with-driver.xml b/logback-classic/src/test/input/integration/db/postgresql-with-driver.xml
index 976ddc7..0bcade1 100644
--- a/logback-classic/src/test/input/integration/db/postgresql-with-driver.xml
+++ b/logback-classic/src/test/input/integration/db/postgresql-with-driver.xml
@@ -12,7 +12,7 @@
</appender>
<root>
- <level value="debug" />
+ <level value="DEBUG" />
<appender-ref ref="DB" />
</root>
</configuration>
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderIntegrationTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderIntegrationTest.java
index ce0d3da..34c6001 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderIntegrationTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderIntegrationTest.java
@@ -14,9 +14,16 @@
package ch.qos.logback.classic.db;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import java.net.InetAddress;
-import java.util.Random;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.HashMap;
+import java.util.Map;
import org.junit.After;
import org.junit.AfterClass;
@@ -29,9 +36,11 @@ import org.slf4j.MDC;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.joran.JoranConfigurator;
+import ch.qos.logback.core.db.DriverManagerConnectionSource;
import ch.qos.logback.core.joran.spi.JoranException;
-import ch.qos.logback.core.status.Status;
+import ch.qos.logback.core.status.StatusChecker;
import ch.qos.logback.core.testUtil.Env;
+import ch.qos.logback.core.testUtil.RandomUtil;
import ch.qos.logback.core.util.StatusPrinter;
public class DBAppenderIntegrationTest {
@@ -41,8 +50,8 @@ public class DBAppenderIntegrationTest {
static String[] POSTGRES_CONFORMING_HOST_LIST = new String[] { "haro" };
static String[] MYSQL_CONFORMING_HOST_LIST = new String[] { "haro" };
static String[] ORACLE_CONFORMING_HOST_LIST = new String[] { "haro" };
-
- int diff = new Random(System.nanoTime()).nextInt(10000);
+
+ int diff = RandomUtil.getPositiveInt();
LoggerContext lc = new LoggerContext();
@BeforeClass
@@ -66,7 +75,17 @@ public class DBAppenderIntegrationTest {
lc.stop();
}
- public void doTest(String configFile) throws JoranException {
+ DriverManagerConnectionSource getConnectionSource() {
+ ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger) lc
+ .getLogger(Logger.ROOT_LOGGER_NAME);
+
+ DBAppender dbAppender = (DBAppender) root.getAppender("DB");
+ assertNotNull(dbAppender);
+ return (DriverManagerConnectionSource) dbAppender.getConnectionSource();
+
+ }
+
+ public void doTest(String configFile) throws JoranException, SQLException {
JoranConfigurator configurator = new JoranConfigurator();
configurator.setContext(lc);
configurator.doConfigure(configFile);
@@ -76,16 +95,86 @@ public class DBAppenderIntegrationTest {
MDC.put("userid", "user" + diff);
int runLength = 5;
for (int i = 1; i <= runLength; i++) {
- logger.debug("This is a debug message. Message number: " + i);
+ logger.debug("This is a debug message. Message number: " + (diff + i));
}
Exception e = new Exception("Just testing", getCause());
- logger
- .error("At last an error.", e);
+ logger.error("At last an error.", e);
+
+ long lastEventId = getLastEventId();
+ verify(lastEventId);
+
// check that there were no errors
- StatusPrinter.print(lc);
- assertEquals(Status.INFO, lc.getStatusManager().getLevel());
+ StatusChecker checker = new StatusChecker(lc);
+ assertTrue(checker.isErrorFree());
+ StatusPrinter.printInCaseOfErrorsOrWarnings(lc);
+ }
+
+ long getLastEventId() throws SQLException {
+ DriverManagerConnectionSource cs = getConnectionSource();
+
+ Connection con = cs.getConnection();
+ Statement statement = con.createStatement();
+ statement.setMaxRows(1);
+ ResultSet rs = statement
+ .executeQuery("select event_id from logging_event order by event_id desc");
+ rs.next();
+ long eventId = rs.getLong(1);
+ rs.close();
+ statement.close();
+ return eventId;
+ }
+
+ void verify(long lastEventId) throws SQLException {
+ verifyDebugMsg(lastEventId);
+ verifyException(lastEventId);
+ verifyProperty(lastEventId);
+
+ }
+
+ void verifyDebugMsg(long lastEventId) throws SQLException {
+ DriverManagerConnectionSource cs = getConnectionSource();
+ Connection con = cs.getConnection();
+ Statement statement = con.createStatement();
+ ResultSet rs = statement
+ .executeQuery("select formatted_message from logging_event where event_id='"
+ + (lastEventId - 1) + "'");
+ rs.next();
+ String msg = rs.getString(1);
+ assertEquals("This is a debug message. Message number: " + (diff + 5), msg);
+ }
+
+ void verifyProperty(long lastEventId) throws SQLException {
+ DriverManagerConnectionSource cs = getConnectionSource();
+ Connection con = cs.getConnection();
+ Statement statement = con.createStatement();
+ ResultSet rs = statement
+ .executeQuery("select mapped_key, mapped_value from logging_event_property where event_id='"
+ + (lastEventId - 1) + "'");
+
+ Map<String, String> witness = lc.getCopyOfPropertyMap();
+ witness.putAll(MDC.getCopyOfContextMap());
+
+ Map map = new HashMap();
+ while (rs.next()) {
+ String key = rs.getString(1);
+ String val = rs.getString(2);
+ map.put(key, val);
+ }
+
+ assertEquals(witness, map);
+ }
+ void verifyException(long lastEventId) throws SQLException {
+ DriverManagerConnectionSource cs = getConnectionSource();
+ Connection con = cs.getConnection();
+ Statement statement = con.createStatement();
+ ResultSet rs = statement
+ .executeQuery("select trace_line from logging_event_exception where event_id='"
+ + (lastEventId) + "' AND I='0'");
+ rs.next();
+ String traceLine = rs.getString(1);
+ assertEquals("java.lang.Exception: Just testing", traceLine);
}
Throwable getCause() {
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/pattern/ExtendedThrowableProxyConverterTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/pattern/ExtendedThrowableProxyConverterTest.java
index 8a2e364..3ccdd39 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/pattern/ExtendedThrowableProxyConverterTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/pattern/ExtendedThrowableProxyConverterTest.java
@@ -93,7 +93,7 @@ public class ExtendedThrowableProxyConverterTest {
ILoggingEvent le = createLoggingEvent(t);
String result = etpc.convert(le);
result = result.replace("common frames omitted", "more");
- result = result.replaceAll(" \\[.*\\]", "");
+ result = result.replaceAll(" ~?\\[.*\\]", "");
assertEquals(sw.toString(), result);
}
-----------------------------------------------------------------------
Summary of changes:
.../ch/qos/logback/access/db/dialect/hsqldb.sql | 4 +-
.../ch/qos/logback/access/db/dialect/mysql.sql | 8 +-
.../ch/qos/logback/access/db/dialect/oracle.sql | 6 +-
.../qos/logback/access/db/dialect/postgresql.sql | 6 +-
.../integration/db/postgresql-with-driver.xml | 18 ++--
.../java/ch/qos/logback/classic/db/DBAppender.java | 3 -
.../java/ch/qos/logback/classic/db/dialect/h2.sql | 54 +++++-----
.../ch/qos/logback/classic/db/dialect/hsqldb.sql | 54 +++++-----
.../ch/qos/logback/classic/db/dialect/mysql.sql | 54 +++++-----
.../ch/qos/logback/classic/db/dialect/oracle.sql | 2 +-
.../qos/logback/classic/db/dialect/postgresql.sql | 8 +-
.../classic/db/names/DefaultDBNameResolver.java | 10 ++-
.../integration/db/postgresql-with-driver.xml | 2 +-
.../classic/db/DBAppenderIntegrationTest.java | 109 ++++++++++++++++++--
.../ExtendedThrowableProxyConverterTest.java | 2 +-
15 files changed, 215 insertions(+), 125 deletions(-)
hooks/post-receive
--
Logback: the generic, reliable, fast and flexible logging framework.
1
0

[GIT] Logback: the generic, reliable, fast and flexible logging framework. branch, master, updated. v0.9.18-113-g2181956
by git-noreply@pixie.qos.ch 23 Mar '10
by git-noreply@pixie.qos.ch 23 Mar '10
23 Mar '10
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Logback: the generic, reliable, fast and flexible logging framework.".
The branch, master has been updated
via 2181956a1dae32a14218f9da2d844e8913bb218e (commit)
from 16e8cfbd6a3a9cb96a883270907792400790dc49 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=2181956a1dae32a14218f9da…
http://github.com/ceki/logback/commit/2181956a1dae32a14218f9da2d844e8913bb2…
commit 2181956a1dae32a14218f9da2d844e8913bb218e
Author: Ceki Gulcu <ceki(a)qos.ch>
Date: Tue Mar 23 19:58:33 2010 +0100
- event_id is now expected to be of type LONG. This is a first step in
fixing http://jira.qos.ch/browse/LBCLASSIC-198 (more tests to follow)
diff --git a/logback-access/src/main/java/ch/qos/logback/access/db/DBAppender.java b/logback-access/src/main/java/ch/qos/logback/access/db/DBAppender.java
index 0f1879d..b8e3a25 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/db/DBAppender.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/db/DBAppender.java
@@ -82,7 +82,7 @@ public class DBAppender extends DBAppenderBase<AccessEvent> {
}
if (insertHeaders) {
- int eventId = selectEventId(insertStatement, connection);
+ long eventId = selectEventId(insertStatement, connection);
addRequestHeaders(event, connection, eventId);
}
}
@@ -102,7 +102,7 @@ public class DBAppender extends DBAppenderBase<AccessEvent> {
}
void addRequestHeaders(AccessEvent event,
- Connection connection, int eventId) throws SQLException {
+ Connection connection, long eventId) throws SQLException {
Enumeration names = event.getRequestHeaderNames();
if (names.hasMoreElements()) {
PreparedStatement insertHeaderStatement = connection
@@ -113,7 +113,7 @@ public class DBAppender extends DBAppenderBase<AccessEvent> {
String key = (String) names.nextElement();
String value = (String) event.getRequestHeader(key);
- insertHeaderStatement.setInt(1, eventId);
+ insertHeaderStatement.setLong(1, eventId);
insertHeaderStatement.setString(2, key);
insertHeaderStatement.setString(3, value);
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/db/DBAppender.java b/logback-classic/src/main/java/ch/qos/logback/classic/db/DBAppender.java
index 7c92e50..68c398f 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/db/DBAppender.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/db/DBAppender.java
@@ -94,8 +94,10 @@ public class DBAppender extends DBAppenderBase<ILoggingEvent> {
addWarn("Failed to insert loggingEvent");
}
- int eventId = selectEventId(insertStatement, connection);
+ long eventId = selectEventId(insertStatement, connection);
+ System.out.println("eventId"+eventId);
+
Map<String, String> mergedMap = mergePropertyMaps(event);
insertProperties(mergedMap, connection, eventId);
@@ -155,7 +157,7 @@ public class DBAppender extends DBAppenderBase<ILoggingEvent> {
}
protected void insertProperties(Map<String, String> mergedMap,
- Connection connection, int eventId) throws SQLException {
+ Connection connection, long eventId) throws SQLException {
Set propertiesKeys = mergedMap.keySet();
if (propertiesKeys.size() > 0) {
PreparedStatement insertPropertiesStatement = connection
@@ -165,7 +167,7 @@ public class DBAppender extends DBAppenderBase<ILoggingEvent> {
String key = (String) i.next();
String value = (String) mergedMap.get(key);
- insertPropertiesStatement.setInt(1, eventId);
+ insertPropertiesStatement.setLong(1, eventId);
insertPropertiesStatement.setString(2, key);
insertPropertiesStatement.setString(3, value);
@@ -190,8 +192,8 @@ public class DBAppender extends DBAppenderBase<ILoggingEvent> {
* batch updates are not supported.
*/
void updateExceptionStatement(PreparedStatement exceptionStatement,
- String txt, short i, int eventId) throws SQLException {
- exceptionStatement.setInt(1, eventId);
+ String txt, short i, long eventId) throws SQLException {
+ exceptionStatement.setLong(1, eventId);
exceptionStatement.setShort(2, i);
exceptionStatement.setString(3, txt);
if (cnxSupportsBatchUpdates) {
@@ -202,7 +204,7 @@ public class DBAppender extends DBAppenderBase<ILoggingEvent> {
}
short buildExceptionStatement(IThrowableProxy tp, short baseIndex,
- PreparedStatement insertExceptionStatement, int eventId)
+ PreparedStatement insertExceptionStatement, long eventId)
throws SQLException {
StringBuilder buf = new StringBuilder();
@@ -232,7 +234,7 @@ public class DBAppender extends DBAppenderBase<ILoggingEvent> {
}
protected void insertThrowable(IThrowableProxy tp, Connection connection,
- int eventId) throws SQLException {
+ long eventId) throws SQLException {
PreparedStatement exceptionStatement = connection
.prepareStatement(insertExceptionSQL);
@@ -246,6 +248,7 @@ public class DBAppender extends DBAppenderBase<ILoggingEvent> {
if (cnxSupportsBatchUpdates) {
exceptionStatement.executeBatch();
+ System.out.println("executin batch");
}
exceptionStatement.close();
exceptionStatement = null;
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/h2.sql b/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/h2.sql
index 0ba314d..f8660c0 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/h2.sql
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/h2.sql
@@ -1,35 +1,36 @@
# This SQL script creates the required tables by ch.qos.logback.classic.db.DBAppender.
#
-# It is intended for HSQL databases. It has been tested on HSQL 1.8.07.
+# It is intended for H2 databases.
-DROP TABLE logging_event_exception IF EXISTS;
-DROP TABLE logging_event_property IF EXISTS;
-DROP TABLE logging_event IF EXISTS;
-CREATE TABLE logging_event (
- timestmp BIGINT NOT NULL,
- formatted_message LONGVARCHAR NOT NULL,
- logger_name VARCHAR(256) NOT NULL,
- level_string VARCHAR(256) NOT NULL,
- thread_name VARCHAR(256),
- reference_flag SMALLINT,
- caller_filename VARCHAR(256),
- caller_class VARCHAR(256),
- caller_method VARCHAR(256),
- caller_line CHAR(4),
- event_id INT NOT NULL IDENTITY);
+DROP TABLE LOGGING_EVENT_EXCEPTION IF EXISTSu;
+DROP TABLE LOGGING_EVENT_PROPERTY IF EXISTS;
+DROP TABLE LOGGING_EVENT IF EXISTS;
+CREATE TABLE LOGGING_EVENT (
+ TIMESTMP BIGINT NOT NULL,
+ FORMATTED_MESSAGE LONGVARCHAR NOT NULL,
+ LOGGER_NAME VARCHAR(256) NOT NULL,
+ LEVEL_STRING VARCHAR(256) NOT NULL,
+ THREAD_NAME VARCHAR(256),
+ REFERENCE_FLAG SMALLINT,
+ CALLER_FILENAME VARCHAR(256),
+ CALLER_CLASS VARCHAR(256),
+ CALLER_METHOD VARCHAR(256),
+ CALLER_LINE CHAR(4),
+ EVENT_ID IDENTITY NOT NULL);
-CREATE TABLE logging_event_property (
- event_id INT NOT NULL,
- mapped_key VARCHAR(254) NOT NULL,
- mapped_value LONGVARCHAR,
- PRIMARY KEY(event_id, mapped_key),
- FOREIGN KEY (event_id) REFERENCES logging_event(event_id));
-CREATE TABLE logging_event_exception (
- event_id INT NOT NULL,
- i SMALLINT NOT NULL,
- trace_line VARCHAR(256) NOT NULL,
- PRIMARY KEY(event_id, i),
- FOREIGN KEY (event_id) REFERENCES logging_event(event_id));
\ No newline at end of file
+CREATE TABLE LOGGING_EVENT_PROPERTY (
+ EVENT_ID BIGINT NOT NULL,
+ MAPPED_KEY VARCHAR(254) NOT NULL,
+ MAPPED_VALUE LONGVARCHAR,
+ PRIMARY KEY(EVENT_ID, MAPPED_KEY),
+ FOREIGN KEY (EVENT_ID) REFERENCES LOGGING_EVENT(EVENT_ID));
+
+CREATE TABLE LOGGING_EVENT_EXCEPTION (
+ EVENT_ID BIGINT NOT NULL,
+ I SMALLINT NOT NULL,
+ TRACE_LINE VARCHAR(256) NOT NULL,
+ PRIMARY KEY(EVENT_ID, I),
+ FOREIGN KEY (EVENT_ID) REFERENCES LOGGING_EVENT(EVENT_ID));
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/hsqldb.sql b/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/hsqldb.sql
index 3cdeccc..e308f34 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/hsqldb.sql
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/hsqldb.sql
@@ -2,34 +2,34 @@
#
# It is intended for HSQL databases. It has been tested on HSQL 1.8.07.
-DROP TABLE logging_event_exception IF EXISTS;
-DROP TABLE logging_event_property IF EXISTS;
-DROP TABLE logging_event IF EXISTS;
+DROP TABLE LOGGING_EVENT_EXCEPTION IF EXISTSu;
+DROP TABLE LOGGING_EVENT_PROPERTY IF EXISTS;
+DROP TABLE LOGGING_EVENT IF EXISTS;
-CREATE TABLE logging_event (
- timestmp BIGINT NOT NULL,
- formatted_message LONGVARCHAR NOT NULL,
- logger_name VARCHAR(256) NOT NULL,
- level_string VARCHAR(256) NOT NULL,
- thread_name VARCHAR(256),
- reference_flag SMALLINT,
- caller_filename VARCHAR(256),
- caller_class VARCHAR(256),
- caller_method VARCHAR(256),
- caller_line CHAR(4),
- event_id INT NOT NULL IDENTITY);
+CREATE TABLE LOGGING_EVENT (
+ TIMESTMP BIGINT NOT NULL,
+ FORMATTED_MESSAGE LONGVARCHAR NOT NULL,
+ LOGGER_NAME VARCHAR(256) NOT NULL,
+ LEVEL_STRING VARCHAR(256) NOT NULL,
+ THREAD_NAME VARCHAR(256),
+ REFERENCE_FLAG SMALLINT,
+ CALLER_FILENAME VARCHAR(256),
+ CALLER_CLASS VARCHAR(256),
+ CALLER_METHOD VARCHAR(256),
+ CALLER_LINE CHAR(4),
+ EVENT_ID BIGINT NOT NULL IDENTITY);
-CREATE TABLE logging_event_property (
- event_id INT NOT NULL,
- mapped_key VARCHAR(254) NOT NULL,
- mapped_value LONGVARCHAR,
- PRIMARY KEY(event_id, mapped_key),
- FOREIGN KEY (event_id) REFERENCES logging_event(event_id));
+CREATE TABLE LOGGING_EVENT_PROPERTY (
+ EVENT_ID BIGINT NOT NULL,
+ MAPPED_KEY VARCHAR(254) NOT NULL,
+ MAPPED_VALUE LONGVARCHAR,
+ PRIMARY KEY(EVENT_ID, MAPPED_KEY),
+ FOREIGN KEY (EVENT_ID) REFERENCES LOGGING_EVENT(EVENT_ID));
-CREATE TABLE logging_event_exception (
- event_id INT NOT NULL,
- i SMALLINT NOT NULL,
- trace_line VARCHAR(256) NOT NULL,
- PRIMARY KEY(event_id, i),
- FOREIGN KEY (event_id) REFERENCES logging_event(event_id));
\ No newline at end of file
+CREATE TABLE LOGGING_EVENT_EXCEPTION (
+ EVENT_ID BIGINT NOT NULL,
+ I SMALLINT NOT NULL,
+ TRACE_LINE VARCHAR(256) NOT NULL,
+ PRIMARY KEY(EVENT_ID, I),
+ FOREIGN KEY (EVENT_ID) REFERENCES LOGGING_EVENT(EVENT_ID));
\ No newline at end of file
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderH2Test.java b/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderH2Test.java
index 3ba8e00..286d570 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderH2Test.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderH2Test.java
@@ -14,6 +14,7 @@
package ch.qos.logback.classic.db;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.sql.ResultSet;
@@ -21,6 +22,7 @@ import java.sql.SQLException;
import java.sql.Statement;
import java.util.Map;
+import org.apache.log4j.MDC;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -31,6 +33,7 @@ import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.classic.spi.LoggingEvent;
import ch.qos.logback.core.db.DriverManagerConnectionSource;
+import ch.qos.logback.core.testUtil.RandomUtil;
import ch.qos.logback.core.util.StatusPrinter;
public class DBAppenderH2Test {
@@ -39,8 +42,8 @@ public class DBAppenderH2Test {
Logger logger;
DBAppender appender;
DriverManagerConnectionSource connectionSource;
-
DBAppenderH2TestFixture dbAppenderH2TestFixture;
+ int diff = RandomUtil.getPositiveInt();
@Before
public void setUp() throws SQLException {
@@ -58,6 +61,7 @@ public class DBAppenderH2Test {
connectionSource.setContext(lc);
connectionSource.setDriverClass(DBAppenderH2TestFixture.H2_DRIVER_CLASS);
connectionSource.setUrl(dbAppenderH2TestFixture.url);
+ System.out.println("cs.url="+dbAppenderH2TestFixture.url);
connectionSource.setUser(dbAppenderH2TestFixture.user);
connectionSource.setPassword(dbAppenderH2TestFixture.password);
@@ -109,17 +113,23 @@ public class DBAppenderH2Test {
@Test
public void testAppendThrowable() throws SQLException {
ILoggingEvent event = createLoggingEvent();
-
appender.append(event);
-
Statement stmt = connectionSource.getConnection().createStatement();
ResultSet rs = null;
- rs = stmt.executeQuery("SELECT * FROM logging_event_exception where event_id = 0");
+ rs = stmt.executeQuery("SELECT * FROM LOGGING_EVENT_EXCEPTION WHERE EVENT_ID=1");
+ rs.next();
+ String expected = "java.lang.Exception: test Ex";
+ String firstLine = rs.getString(3);
+ assertTrue("["+firstLine+"] does not match ["+expected+"]", firstLine.contains(expected));
+
int i = 0;
while (rs.next()) {
- assertEquals(event.getThrowableProxy().getStackTraceElementProxyArray()[i].toString(), rs.getString(3));
+ expected = event.getThrowableProxy().getStackTraceElementProxyArray()[i].toString();
+ String st = rs.getString(3);
+ assertTrue("["+st+"] does not match ["+expected+"]", st.contains(expected));
i++;
}
+ assertTrue(i != 0);
rs.close();
stmt.close();
@@ -127,21 +137,24 @@ public class DBAppenderH2Test {
@Test
public void testContextInfo() throws SQLException {
- ILoggingEvent event = createLoggingEvent();
lc.putProperty("testKey1", "testValue1");
+ MDC.put("k"+diff, "v"+diff);
+ ILoggingEvent event = createLoggingEvent();
appender.append(event);
Statement stmt = connectionSource.getConnection().createStatement();
ResultSet rs = null;
- rs = stmt.executeQuery("SELECT * FROM logging_event_property where event_id = 0");
+ rs = stmt.executeQuery("SELECT * FROM LOGGING_EVENT_PROPERTY WHERE EVENT_ID=1");
Map<String, String> map = appender.mergePropertyMaps(event);
+ int i = 0;
while (rs.next()) {
String key = rs.getString(2);
assertEquals(map.get(key), rs.getString(3));
- //System.out.println("value: " + map.get(key));
+ i++;
}
-
+ assertTrue(map.size() != 0);
+ assertEquals(map.size(), i);
rs.close();
stmt.close();
}
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderH2TestFixture.java b/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderH2TestFixture.java
index 8727b25..810e73a 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderH2TestFixture.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderH2TestFixture.java
@@ -31,7 +31,6 @@ public class DBAppenderH2TestFixture {
}
public static final String H2_DRIVER_CLASS = "org.h2.Driver";
- // String serverProps;
String url = null;
String user = "sa";
String password = "";
@@ -70,6 +69,7 @@ public class DBAppenderH2TestFixture {
}
Connection newConnection() throws SQLException {
+ System.out.println("url="+url);
org.h2.Driver driver = Driver.load();
Properties props = new Properties();
props.setProperty("user", user);
@@ -80,50 +80,50 @@ public class DBAppenderH2TestFixture {
private void createTables() throws SQLException {
assertNotNull(connection);
StringBuffer buf = new StringBuffer();
- buf.append("CREATE TABLE logging_event (");
- buf.append("timestmp BIGINT NOT NULL,");
- buf.append("formatted_message LONGVARCHAR NOT NULL,");
- buf.append("logger_name VARCHAR(256) NOT NULL,");
- buf.append("level_string VARCHAR(256) NOT NULL,");
- buf.append("thread_name VARCHAR(256),");
- buf.append("reference_flag SMALLINT,");
- buf.append("caller_filename VARCHAR(256), ");
- buf.append("caller_class VARCHAR(256), ");
- buf.append("caller_method VARCHAR(256), ");
- buf.append("caller_line CHAR(4), ");
- buf.append("event_id INT NOT NULL IDENTITY);");
+ buf.append("CREATE TABLE LOGGING_EVENT (");
+ buf.append("TIMESTMP BIGINT NOT NULL,");
+ buf.append("FORMATTED_MESSAGE LONGVARCHAR NOT NULL,");
+ buf.append("LOGGER_NAME VARCHAR(256) NOT NULL,");
+ buf.append("LEVEL_STRING VARCHAR(256) NOT NULL,");
+ buf.append("THREAD_NAME VARCHAR(256),");
+ buf.append("REFERENCE_FLAG SMALLINT,");
+ buf.append("CALLER_FILENAME VARCHAR(256), ");
+ buf.append("CALLER_CLASS VARCHAR(256), ");
+ buf.append("CALLER_METHOD VARCHAR(256), ");
+ buf.append("CALLER_LINE CHAR(4), ");
+ buf.append("EVENT_ID IDENTITY NOT NULL);");
executeQuery(connection, buf.toString());
buf = new StringBuffer();
- buf.append("CREATE TABLE logging_event_property (");
- buf.append("event_id INT NOT NULL,");
- buf.append("mapped_key VARCHAR(254) NOT NULL,");
- buf.append("mapped_value LONGVARCHAR,");
- buf.append("PRIMARY KEY(event_id, mapped_key),");
- buf.append("FOREIGN KEY (event_id) REFERENCES logging_event(event_id));");
+ buf.append("CREATE TABLE LOGGING_EVENT_PROPERTY (");
+ buf.append("EVENT_ID BIGINT NOT NULL,");
+ buf.append("MAPPED_KEY VARCHAR(254) NOT NULL,");
+ buf.append("MAPPED_VALUE LONGVARCHAR,");
+ buf.append("PRIMARY KEY(EVENT_ID, MAPPED_KEY),");
+ buf.append("FOREIGN KEY (EVENT_ID) REFERENCES LOGGING_EVENT(EVENT_ID));");
executeQuery(connection, buf.toString());
buf = new StringBuffer();
- buf.append("CREATE TABLE logging_event_exception (");
- buf.append("event_id INT NOT NULL,");
- buf.append("i SMALLINT NOT NULL,");
- buf.append("trace_line VARCHAR(256) NOT NULL,");
- buf.append("PRIMARY KEY(event_id, i),");
- buf.append("FOREIGN KEY (event_id) REFERENCES logging_event(event_id));");
+ buf.append("CREATE TABLE LOGGING_EVENT_EXCEPTION (");
+ buf.append("EVENT_ID BIGINT NOT NULL,");
+ buf.append("I SMALLINT NOT NULL,");
+ buf.append("TRACE_LINE VARCHAR(256) NOT NULL,");
+ buf.append("PRIMARY KEY(EVENT_ID, I),");
+ buf.append("FOREIGN KEY (EVENT_ID) REFERENCES LOGGING_EVENT(EVENT_ID));");
executeQuery(connection, buf.toString());
}
private void dropTables() throws SQLException {
StringBuffer buf = new StringBuffer();
- buf.append("DROP TABLE logging_event_exception IF EXISTS;");
+ buf.append("DROP TABLE LOGGING_EVENT_EXCEPTION IF EXISTS;");
executeQuery(connection, buf.toString());
buf = new StringBuffer();
- buf.append("DROP TABLE logging_event_property IF EXISTS;");
+ buf.append("DROP TABLE LOGGING_EVENT_PROPERTY IF EXISTS;");
executeQuery(connection, buf.toString());
buf = new StringBuffer();
- buf.append("DROP TABLE logging_event IF EXISTS;");
+ buf.append("DROP TABLE LOGGING_EVENT IF EXISTS;");
executeQuery(connection, buf.toString());
}
@@ -132,7 +132,7 @@ public class DBAppenderH2TestFixture {
st = conn.createStatement();
int i = st.executeUpdate(expression);
if (i == -1) {
- System.out.println("db error : " + expression);
+ throw new IllegalStateException("db error : " + expression);
}
st.close();
}
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderHSQLTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderHSQLTest.java
index 51117cd..20cead3 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderHSQLTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderHSQLTest.java
@@ -14,6 +14,7 @@
package ch.qos.logback.classic.db;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.sql.ResultSet;
@@ -21,6 +22,7 @@ import java.sql.SQLException;
import java.sql.Statement;
import java.util.Map;
+import org.apache.log4j.MDC;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -31,6 +33,7 @@ import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.classic.spi.LoggingEvent;
import ch.qos.logback.core.db.DriverManagerConnectionSource;
+import ch.qos.logback.core.testUtil.RandomUtil;
public class DBAppenderHSQLTest {
@@ -40,6 +43,7 @@ public class DBAppenderHSQLTest {
DriverManagerConnectionSource connectionSource;
DBAppenderHSQLTestFixture dbAppenderHSQLTestFixture;
+ int diff = RandomUtil.getPositiveInt();
@Before
public void setUp() throws SQLException {
@@ -109,34 +113,46 @@ public class DBAppenderHSQLTest {
Statement stmt = connectionSource.getConnection().createStatement();
ResultSet rs = null;
- rs = stmt.executeQuery("SELECT * FROM logging_event_exception where event_id = 0");
+ rs = stmt.executeQuery("SELECT * FROM LOGGING_EVENT_EXCEPTION where EVENT_ID = 0");
+
+ rs.next();
+ String expected = "java.lang.Exception: test Ex";
+ String firstLine = rs.getString(3);
+ assertTrue("["+firstLine+"] does not match ["+expected+"]", firstLine.contains(expected));
+
int i = 0;
while (rs.next()) {
- assertEquals(event.getThrowableProxy().getStackTraceElementProxyArray()[i].toString(), rs.getString(3));
+ expected = event.getThrowableProxy().getStackTraceElementProxyArray()[i].toString();
+ String st = rs.getString(3);
+ assertTrue("["+st+"] does not match ["+expected+"]", st.contains(expected));
i++;
}
-
+ assertTrue(i != 0);
rs.close();
stmt.close();
}
@Test
public void testContextInfo() throws SQLException {
- ILoggingEvent event = createLoggingEvent();
lc.putProperty("testKey1", "testValue1");
+ MDC.put("k"+diff, "v"+diff);
+ ILoggingEvent event = createLoggingEvent();
appender.append(event);
Statement stmt = connectionSource.getConnection().createStatement();
ResultSet rs = null;
- rs = stmt.executeQuery("SELECT * FROM logging_event_property where event_id = 0");
+ rs = stmt.executeQuery("SELECT * FROM LOGGING_EVENT_PROPERTY WHERE EVENT_ID = 0");
Map<String, String> map = appender.mergePropertyMaps(event);
+ System.out.println("ma.size="+map.size());
+ int i = 0;
while (rs.next()) {
String key = rs.getString(2);
assertEquals(map.get(key), rs.getString(3));
- //System.out.println("value: " + map.get(key));
+ i++;
}
-
+ assertTrue(map.size() != 0);
+ assertEquals(map.size(), i);
rs.close();
stmt.close();
}
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderHSQLTestFixture.java b/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderHSQLTestFixture.java
index 1f6e00f..30f8a58 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderHSQLTestFixture.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderHSQLTestFixture.java
@@ -108,51 +108,51 @@ public class DBAppenderHSQLTestFixture {
Connection conn = newConnection();
assertNotNull(conn);
StringBuffer buf = new StringBuffer();
- buf.append("CREATE TABLE logging_event (");
- buf.append("timestmp BIGINT NOT NULL,");
- buf.append("formatted_message LONGVARCHAR NOT NULL,");
- buf.append("logger_name VARCHAR(256) NOT NULL,");
- buf.append("level_string VARCHAR(256) NOT NULL,");
- buf.append("thread_name VARCHAR(256),");
- buf.append("reference_flag SMALLINT,");
- buf.append("caller_filename VARCHAR(256), ");
- buf.append("caller_class VARCHAR(256), ");
- buf.append("caller_method VARCHAR(256), ");
- buf.append("caller_line CHAR(4), ");
- buf.append("event_id INT NOT NULL IDENTITY);");
+ buf.append("CREATE TABLE LOGGING_EVENT (");
+ buf.append("TIMESTMP BIGINT NOT NULL,");
+ buf.append("FORMATTED_MESSAGE LONGVARCHAR NOT NULL,");
+ buf.append("LOGGER_NAME VARCHAR(256) NOT NULL,");
+ buf.append("LEVEL_STRING VARCHAR(256) NOT NULL,");
+ buf.append("THREAD_NAME VARCHAR(256),");
+ buf.append("REFERENCE_FLAG SMALLINT,");
+ buf.append("CALLER_FILENAME VARCHAR(256), ");
+ buf.append("CALLER_CLASS VARCHAR(256), ");
+ buf.append("CALLER_METHOD VARCHAR(256), ");
+ buf.append("CALLER_LINE CHAR(4), ");
+ buf.append("EVENT_ID BIGINT NOT NULL IDENTITY);");
query(conn, buf.toString());
buf = new StringBuffer();
- buf.append("CREATE TABLE logging_event_property (");
- buf.append("event_id INT NOT NULL,");
- buf.append("mapped_key VARCHAR(254) NOT NULL,");
- buf.append("mapped_value LONGVARCHAR,");
- buf.append("PRIMARY KEY(event_id, mapped_key),");
- buf.append("FOREIGN KEY (event_id) REFERENCES logging_event(event_id));");
+ buf.append("CREATE TABLE LOGGING_EVENT_PROPERTY (");
+ buf.append("EVENT_ID BIGINT NOT NULL,");
+ buf.append("MAPPED_KEY VARCHAR(254) NOT NULL,");
+ buf.append("MAPPED_VALUE LONGVARCHAR,");
+ buf.append("PRIMARY KEY(EVENT_ID, MAPPED_KEY),");
+ buf.append("FOREIGN KEY (EVENT_ID) REFERENCES LOGGING_EVENT(EVENT_ID));");
query(conn, buf.toString());
buf = new StringBuffer();
- buf.append("CREATE TABLE logging_event_exception (");
- buf.append("event_id INT NOT NULL,");
- buf.append("i SMALLINT NOT NULL,");
- buf.append("trace_line VARCHAR(256) NOT NULL,");
- buf.append("PRIMARY KEY(event_id, i),");
- buf.append("FOREIGN KEY (event_id) REFERENCES logging_event(event_id));");
+ buf.append("CREATE TABLE LOGGING_EVENT_EXCEPTION (");
+ buf.append("EVENT_ID BIGINT NOT NULL,");
+ buf.append("I SMALLINT NOT NULL,");
+ buf.append("TRACE_LINE VARCHAR(256) NOT NULL,");
+ buf.append("PRIMARY KEY(EVENT_ID, I),");
+ buf.append("FOREIGN KEY (EVENT_ID) REFERENCES LOGGING_EVENT(EVENT_ID));");
query(conn, buf.toString());
}
private void dropTables() throws SQLException {
Connection conn = newConnection();
StringBuffer buf = new StringBuffer();
- buf.append("DROP TABLE logging_event_exception IF EXISTS;");
+ buf.append("DROP TABLE LOGGING_EVENT_EXCEPTION IF EXISTS;");
query(conn, buf.toString());
buf = new StringBuffer();
- buf.append("DROP TABLE logging_event_property IF EXISTS;");
+ buf.append("DROP TABLE LOGGING_EVENT_PROPERTY IF EXISTS;");
query(conn, buf.toString());
buf = new StringBuffer();
- buf.append("DROP TABLE logging_event IF EXISTS;");
+ buf.append("DROP TABLE LOGGING_EVENT IF EXISTS;");
query(conn, buf.toString());
}
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/db/PackageTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/db/PackageTest.java
index 869fe27..5c90451 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/db/PackageTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/db/PackageTest.java
@@ -18,6 +18,7 @@ import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
-@SuiteClasses( {DBAppenderHSQLTest.class})
+@SuiteClasses( { DBAppenderHSQLTest.class, DBAppenderH2Test.class,
+ DBAppenderIntegrationTest.class })
public class PackageTest {
}
\ No newline at end of file
diff --git a/logback-core/src/main/java/ch/qos/logback/core/db/DBAppenderBase.java b/logback-core/src/main/java/ch/qos/logback/core/db/DBAppenderBase.java
index ed08712..373ce6c 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/db/DBAppenderBase.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/db/DBAppenderBase.java
@@ -118,7 +118,7 @@ public abstract class DBAppenderBase<E> extends AppenderBase<E> {
protected abstract void subAppend(Object eventObject, Connection connection,
PreparedStatement statement) throws Throwable;
- protected int selectEventId(PreparedStatement insertStatement,
+ protected long selectEventId(PreparedStatement insertStatement,
Connection connection) throws SQLException, InvocationTargetException {
ResultSet rs = null;
Statement idStatement = null;
@@ -150,7 +150,7 @@ public abstract class DBAppenderBase<E> extends AppenderBase<E> {
// A ResultSet cursor is initially positioned before the first row;
// the first call to the method next makes the first row the current row
rs.next();
- int eventId = rs.getInt(1);
+ long eventId = rs.getLong(1);
rs.close();
-----------------------------------------------------------------------
Summary of changes:
.../java/ch/qos/logback/access/db/DBAppender.java | 6 +-
.../java/ch/qos/logback/classic/db/DBAppender.java | 17 ++++---
.../java/ch/qos/logback/classic/db/dialect/h2.sql | 57 ++++++++++----------
.../ch/qos/logback/classic/db/dialect/hsqldb.sql | 54 +++++++++---------
.../qos/logback/classic/db/DBAppenderH2Test.java | 31 ++++++++---
.../classic/db/DBAppenderH2TestFixture.java | 58 ++++++++++----------
.../qos/logback/classic/db/DBAppenderHSQLTest.java | 30 ++++++++---
.../classic/db/DBAppenderHSQLTestFixture.java | 54 +++++++++---------
.../ch/qos/logback/classic/db/PackageTest.java | 3 +-
.../ch/qos/logback/core/db/DBAppenderBase.java | 4 +-
10 files changed, 174 insertions(+), 140 deletions(-)
hooks/post-receive
--
Logback: the generic, reliable, fast and flexible logging framework.
1
0

[GIT] Logback: the generic, reliable, fast and flexible logging framework. branch, master, updated. v0.9.18-112-g16e8cfb
by git-noreply@pixie.qos.ch 23 Mar '10
by git-noreply@pixie.qos.ch 23 Mar '10
23 Mar '10
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Logback: the generic, reliable, fast and flexible logging framework.".
The branch, master has been updated
via 16e8cfbd6a3a9cb96a883270907792400790dc49 (commit)
from 8d16d5325738f9816f3a191208ccf54cbeaffd3f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=16e8cfbd6a3a9cb96a883270…
http://github.com/ceki/logback/commit/16e8cfbd6a3a9cb96a883270907792400790d…
commit 16e8cfbd6a3a9cb96a883270907792400790dc49
Author: Ceki Gulcu <ceki(a)qos.ch>
Date: Tue Mar 23 18:47:06 2010 +0100
- tests run on oracle (host=hora)
diff --git a/logback-classic/pom.xml b/logback-classic/pom.xml
index 477d694..b52f8f1 100644
--- a/logback-classic/pom.xml
+++ b/logback-classic/pom.xml
@@ -314,7 +314,6 @@ org.slf4j.test_osgi
<profile>
<!-- Integration tests require the host-orion profile -->
<id>host-orion</id>
-
<dependencies>
<!-- locally installed artifact -->
<dependency>
@@ -334,6 +333,19 @@ org.slf4j.test_osgi
</profile>
+ <profile>
+ <!-- Integration tests require the host-hora profile -->
+ <id>host-hora</id>
+ <dependencies>
+ <!-- locally installed artifact -->
+ <dependency>
+ <groupId>com.oracle</groupId>
+ <artifactId>ojdbc14</artifactId>
+ <version>10.2.0.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
</profiles>
</project>
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/oracle.sql b/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/oracle.sql
index e670866..9ac0b79 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/oracle.sql
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/oracle.sql
@@ -13,11 +13,11 @@
CREATE SEQUENCE logging_event_id_seq MINVALUE 1 START WITH 1;
-
+CREATE SEQUENCE logging_event_id_seq MINVALUE 1 START WITH 1;
CREATE TABLE logging_event
(
timestmp NUMBER(20) NOT NULL,
- formatted_message VARCHAR2(4000) NOT NULL,
+ formatted_message VARCHAR2(4000) NOT NULL,
logger_name VARCHAR(254) NOT NULL,
level_string VARCHAR(254) NOT NULL,
thread_name VARCHAR(254),
diff --git a/logback-classic/src/test/input/integration/db/oracle10g-with-driver.xml b/logback-classic/src/test/input/integration/db/oracle10g-with-driver.xml
index 0f601fd..17f9a75 100644
--- a/logback-classic/src/test/input/integration/db/oracle10g-with-driver.xml
+++ b/logback-classic/src/test/input/integration/db/oracle10g-with-driver.xml
@@ -2,17 +2,17 @@
<configuration>
- <appender name="DB" class="ch.qos.logback.classic.db.DBAppender">
- <connectionSource class="ch.qos.logback.core.db.DriverManagerConnectionSource">
- <driverClass>oracle.jdbc.OracleDriver</driverClass>
- <url>jdbc:oracle:thin:@localhost:1522:xe</url>
- <user>hr</user>
- <password>hr</password>
- </connectionSource>
- </appender>
-
- <root>
- <level value="debug" />
- <appender-ref ref="DB" />
- </root>
+ <appender name="DB" class="ch.qos.logback.classic.db.DBAppender">
+ <connectionSource class="ch.qos.logback.core.db.DriverManagerConnectionSource">
+ <driverClass>oracle.jdbc.OracleDriver</driverClass>
+ <url>jdbc:oracle:thin:@localhost:1521:xe</url>
+ <user>test</user>
+ <password>test</password>
+ </connectionSource>
+ </appender>
+
+ <root>
+ <level value="debug" />
+ <appender-ref ref="DB" />
+ </root>
</configuration>
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderIntegrationTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderIntegrationTest.java
index 341d135..ce0d3da 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderIntegrationTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderIntegrationTest.java
@@ -40,7 +40,8 @@ public class DBAppenderIntegrationTest {
static String[] CONFORMING_HOST_LIST = new String[] { "Orion" };
static String[] POSTGRES_CONFORMING_HOST_LIST = new String[] { "haro" };
static String[] MYSQL_CONFORMING_HOST_LIST = new String[] { "haro" };
-
+ static String[] ORACLE_CONFORMING_HOST_LIST = new String[] { "haro" };
+
int diff = new Random(System.nanoTime()).nextInt(10000);
LoggerContext lc = new LoggerContext();
@@ -117,10 +118,9 @@ public class DBAppenderIntegrationTest {
}
@Test
- @Ignore
public void oracle10g() throws Exception {
// perform test only on conforming hosts
- if (!isConformingHostAndJDK16OrHigher()) {
+ if (!isConformingHostAndJDK16OrHigher(ORACLE_CONFORMING_HOST_LIST)) {
return;
}
doTest("src/test/input/integration/db/oracle10g-with-driver.xml");
-----------------------------------------------------------------------
Summary of changes:
logback-classic/pom.xml | 14 ++++++++++-
.../ch/qos/logback/classic/db/dialect/oracle.sql | 4 +-
.../input/integration/db/oracle10g-with-driver.xml | 26 ++++++++++----------
.../classic/db/DBAppenderIntegrationTest.java | 6 ++--
4 files changed, 31 insertions(+), 19 deletions(-)
hooks/post-receive
--
Logback: the generic, reliable, fast and flexible logging framework.
1
0

[GIT] Logback: the generic, reliable, fast and flexible logging framework. branch, master, updated. v0.9.18-111-g8d16d53
by git-noreply@pixie.qos.ch 23 Mar '10
by git-noreply@pixie.qos.ch 23 Mar '10
23 Mar '10
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Logback: the generic, reliable, fast and flexible logging framework.".
The branch, master has been updated
via 8d16d5325738f9816f3a191208ccf54cbeaffd3f (commit)
from e6af6bd2f69de46eed5febf9bb0de8613469a713 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=8d16d5325738f9816f3a1912…
http://github.com/ceki/logback/commit/8d16d5325738f9816f3a191208ccf54cbeaff…
commit 8d16d5325738f9816f3a191208ccf54cbeaffd3f
Author: Ceki Gulcu <ceki(a)qos.ch>
Date: Tue Mar 23 16:16:47 2010 +0100
- DBAppender tests pass with MySQL
diff --git a/logback-classic/pom.xml b/logback-classic/pom.xml
index 9db2104..477d694 100644
--- a/logback-classic/pom.xml
+++ b/logback-classic/pom.xml
@@ -94,6 +94,13 @@
</dependency>
<dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <version>5.1.9</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<scope>compile</scope>
@@ -309,13 +316,6 @@ org.slf4j.test_osgi
<id>host-orion</id>
<dependencies>
- <dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- <version>5.0.8</version>
- <scope>test</scope>
- </dependency>
-
<!-- locally installed artifact -->
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/mysql.sql b/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/mysql.sql
index bc9dabe..e8c2fb3 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/mysql.sql
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/mysql.sql
@@ -1,51 +1,51 @@
# This SQL script creates the required tables by ch.qos.logback.classic.db.DBAppender.
#
-# It is intended for MySQL databases. It has been tested on MySQL 5.0.22 with
-# INNODB tables.
+# It is intended for MySQL databases. It has been tested on MySQL 5.1.37
+# on Linux
BEGIN;
-DROP TABLE IF EXISTS logging_event_property;
-DROP TABLE IF EXISTS logging_event_exception;
-DROP TABLE IF EXISTS logging_event;
+DROP TABLE IF EXISTS LOGGING_EVENT_PROPERTY;
+DROP TABLE IF EXISTS LOGGING_EVENT_EXCEPTION;
+DROP TABLE IF EXISTS LOGGING_EVENT;
COMMIT;
BEGIN;
-CREATE TABLE logging_event
+CREATE TABLE LOGGING_EVENT
(
- timestmp BIGINT NOT NULL,
- formatted_message TEXT NOT NULL,
- logger_name VARCHAR(254) NOT NULL,
- level_string VARCHAR(254) NOT NULL,
- thread_name VARCHAR(254),
- reference_flag SMALLINT,
- caller_filename VARCHAR(254) NOT NULL,
- caller_class VARCHAR(254) NOT NULL,
- caller_method VARCHAR(254) NOT NULL,
- caller_line CHAR(4) NOT NULL,
- event_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY
+ TIMESTMP BIGINT NOT NULL,
+ FORMATTED_MESSAGE TEXT NOT NULL,
+ LOGGER_NAME VARCHAR(254) NOT NULL,
+ LEVEL_STRING VARCHAR(254) NOT NULL,
+ THREAD_NAME VARCHAR(254),
+ REFERENCE_FLAG SMALLINT,
+ CALLER_FILENAME VARCHAR(254) NOT NULL,
+ CALLER_CLASS VARCHAR(254) NOT NULL,
+ CALLER_METHOD VARCHAR(254) NOT NULL,
+ CALLER_LINE CHAR(4) NOT NULL,
+ EVENT_ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY
);
COMMIT;
BEGIN;
-CREATE TABLE logging_event_property
+CREATE TABLE LOGGING_EVENT_PROPERTY
(
- event_id INT NOT NULL,
- mapped_key VARCHAR(254) NOT NULL,
- mapped_value TEXT,
- PRIMARY KEY(event_id, mapped_key),
- FOREIGN KEY (event_id) REFERENCES logging_event(event_id)
+ EVENT_ID INT NOT NULL,
+ MAPPED_KEY VARCHAR(254) NOT NULL,
+ MAPPED_VALUE TEXT,
+ PRIMARY KEY(EVENT_ID, MAPPED_KEY),
+ FOREIGN KEY (EVENT_ID) REFERENCES LOGGING_EVENT(EVENT_ID)
);
COMMIT;
BEGIN;
-CREATE TABLE logging_event_exception
+CREATE TABLE LOGGING_EVENT_EXCEPTION
(
- event_id INT NOT NULL,
- i SMALLINT NOT NULL,
- trace_line VARCHAR(254) NOT NULL,
- PRIMARY KEY(event_id, i),
- FOREIGN KEY (event_id) REFERENCES logging_event(event_id)
+ EVENT_ID INT NOT NULL,
+ I SMALLINT NOT NULL,
+ TRACE_LINE VARCHAR(254) NOT NULL,
+ PRIMARY KEY(EVENT_ID, I),
+ FOREIGN KEY (EVENT_ID) REFERENCES LOGGING_EVENT(EVENT_ID)
);
COMMIT;
\ No newline at end of file
diff --git a/logback-classic/src/test/input/integration/db/mysql-with-driver.xml b/logback-classic/src/test/input/integration/db/mysql-with-driver.xml
index 1f42bac..557554f 100644
--- a/logback-classic/src/test/input/integration/db/mysql-with-driver.xml
+++ b/logback-classic/src/test/input/integration/db/mysql-with-driver.xml
@@ -2,17 +2,17 @@
<configuration>
- <appender name="DB" class="ch.qos.logback.classic.db.DBAppender">
- <connectionSource class="ch.qos.logback.core.db.DriverManagerConnectionSource">
- <driverClass>com.mysql.jdbc.Driver</driverClass>
- <url>jdbc:mysql://localhost:3306/logback</url>
- <user>root</user>
- <password></password>
- </connectionSource>
- </appender>
-
- <root>
- <level value="debug" />
- <appender-ref ref="DB" />
- </root>
+ <appender name="DB" class="ch.qos.logback.classic.db.DBAppender">
+ <connectionSource class="ch.qos.logback.core.db.DriverManagerConnectionSource">
+ <driverClass>com.mysql.jdbc.Driver</driverClass>
+ <url>jdbc:mysql://127.0.0.1:3306/test</url>
+ <user>test</user>
+ <password>test</password>
+ </connectionSource>
+ </appender>
+
+ <root>
+ <level value="debug" />
+ <appender-ref ref="DB" />
+ </root>
</configuration>
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderIntegrationTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderIntegrationTest.java
index e146669..341d135 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderIntegrationTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderIntegrationTest.java
@@ -39,6 +39,7 @@ public class DBAppenderIntegrationTest {
static String LOCAL_HOST_NAME;
static String[] CONFORMING_HOST_LIST = new String[] { "Orion" };
static String[] POSTGRES_CONFORMING_HOST_LIST = new String[] { "haro" };
+ static String[] MYSQL_CONFORMING_HOST_LIST = new String[] { "haro" };
int diff = new Random(System.nanoTime()).nextInt(10000);
LoggerContext lc = new LoggerContext();
@@ -80,7 +81,6 @@ public class DBAppenderIntegrationTest {
Exception e = new Exception("Just testing", getCause());
logger
.error("At last an error.", e);
- e.printStackTrace();
// check that there were no errors
StatusPrinter.print(lc);
assertEquals(Status.INFO, lc.getStatusManager().getLevel());
@@ -139,7 +139,7 @@ public class DBAppenderIntegrationTest {
@Test
public void mysql() throws Exception {
// perform test only on conforming hosts
- if (!isConformingHostAndJDK16OrHigher()) {
+ if (!isConformingHostAndJDK16OrHigher(MYSQL_CONFORMING_HOST_LIST)) {
return;
}
doTest("src/test/input/integration/db/mysql-with-driver.xml");
diff --git a/pom.xml b/pom.xml
index f56f9ec..56ce38e 100755
--- a/pom.xml
+++ b/pom.xml
@@ -104,6 +104,13 @@
<version>8.4-701.jdbc4</version>
</dependency>
<dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <version>5.1.9</version>
+ </dependency>
+
+
+ <dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>catalina</artifactId>
<version>6.0.20</version>
-----------------------------------------------------------------------
Summary of changes:
logback-classic/pom.xml | 14 +++---
.../ch/qos/logback/classic/db/dialect/mysql.sql | 58 ++++++++++----------
.../input/integration/db/mysql-with-driver.xml | 26 +++++-----
.../classic/db/DBAppenderIntegrationTest.java | 4 +-
pom.xml | 7 +++
5 files changed, 58 insertions(+), 51 deletions(-)
hooks/post-receive
--
Logback: the generic, reliable, fast and flexible logging framework.
1
0

[GIT] Logback: the generic, reliable, fast and flexible logging framework. branch, master, updated. v0.9.18-110-ge6af6bd
by git-noreply@pixie.qos.ch 23 Mar '10
by git-noreply@pixie.qos.ch 23 Mar '10
23 Mar '10
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Logback: the generic, reliable, fast and flexible logging framework.".
The branch, master has been updated
via e6af6bd2f69de46eed5febf9bb0de8613469a713 (commit)
from 8ad8f15265b86671678d40c6109245327ef1f9f7 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=e6af6bd2f69de46eed5febf9…
http://github.com/ceki/logback/commit/e6af6bd2f69de46eed5febf9bb0de8613469a…
commit e6af6bd2f69de46eed5febf9bb0de8613469a713
Author: Ceki Gulcu <ceki(a)qos.ch>
Date: Tue Mar 23 14:15:04 2010 +0100
- Adding support for H2 database
diff --git a/logback-classic/pom.xml b/logback-classic/pom.xml
index 41559e0..9db2104 100644
--- a/logback-classic/pom.xml
+++ b/logback-classic/pom.xml
@@ -82,6 +82,12 @@
</dependency>
<dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>test</scope>
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderH2Test.java
similarity index 89%
copy from logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderTest.java
copy to logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderH2Test.java
index ef86c44..3ba8e00 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderH2Test.java
@@ -31,21 +31,23 @@ import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.classic.spi.LoggingEvent;
import ch.qos.logback.core.db.DriverManagerConnectionSource;
+import ch.qos.logback.core.util.StatusPrinter;
-public class DBAppenderTest {
+public class DBAppenderH2Test {
LoggerContext lc;
Logger logger;
DBAppender appender;
DriverManagerConnectionSource connectionSource;
- DBAppenderTestFixture dbAppenderTestFixture;
+ DBAppenderH2TestFixture dbAppenderH2TestFixture;
@Before
public void setUp() throws SQLException {
- dbAppenderTestFixture = new DBAppenderTestFixture();
- dbAppenderTestFixture.setUp();
+ dbAppenderH2TestFixture = new DBAppenderH2TestFixture();
+ dbAppenderH2TestFixture.setUp();
+
lc = new LoggerContext();
lc.setName("default");
logger = lc.getLogger("root");
@@ -54,10 +56,12 @@ public class DBAppenderTest {
appender.setContext(lc);
connectionSource = new DriverManagerConnectionSource();
connectionSource.setContext(lc);
- connectionSource.setDriverClass(DBAppenderTestFixture.HSQLDB_DRIVER_CLASS);
- connectionSource.setUrl(dbAppenderTestFixture.url);
- connectionSource.setUser(dbAppenderTestFixture.user);
- connectionSource.setPassword(dbAppenderTestFixture.password);
+ connectionSource.setDriverClass(DBAppenderH2TestFixture.H2_DRIVER_CLASS);
+ connectionSource.setUrl(dbAppenderH2TestFixture.url);
+ connectionSource.setUser(dbAppenderH2TestFixture.user);
+ connectionSource.setPassword(dbAppenderH2TestFixture.password);
+
+
connectionSource.start();
appender.setConnectionSource(connectionSource);
appender.start();
@@ -69,7 +73,7 @@ public class DBAppenderTest {
lc = null;
appender = null;
connectionSource = null;
- dbAppenderTestFixture.tearDown();
+ dbAppenderH2TestFixture.tearDown();
}
@Test
@@ -77,7 +81,8 @@ public class DBAppenderTest {
ILoggingEvent event = createLoggingEvent();
appender.append(event);
- //StatusPrinter.print(lc.getStatusManager());
+
+ StatusPrinter.print(lc);
Statement stmt = connectionSource.getConnection().createStatement();
ResultSet rs = null;
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderTestFixture.java b/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderH2TestFixture.java
similarity index 64%
copy from logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderTestFixture.java
copy to logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderH2TestFixture.java
index 46cfd2b..8727b25 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderTestFixture.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderH2TestFixture.java
@@ -15,98 +15,70 @@ package ch.qos.logback.classic.db;
import static org.junit.Assert.assertNotNull;
-import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;
-import org.hsqldb.Server;
-import org.hsqldb.ServerConstants;
-import org.hsqldb.jdbcDriver;
+import org.h2.Driver;
-public class DBAppenderTestFixture {
+import ch.qos.logback.core.testUtil.RandomUtil;
- public static final String HSQLDB_DRIVER_CLASS = "org.hsqldb.jdbcDriver";
+public class DBAppenderH2TestFixture {
+
+ public enum H2Mode {
+ MEM, FILE, NET;
+ }
+
+ public static final String H2_DRIVER_CLASS = "org.h2.Driver";
// String serverProps;
String url = null;
String user = "sa";
String password = "";
- Server server;
// boolean isNetwork = true;
- HsqlMode mode = HsqlMode.MEM;
+ H2Mode mode = H2Mode.MEM;
- public DBAppenderTestFixture() {
+ int diff = RandomUtil.getPositiveInt();
+
+ public DBAppenderH2TestFixture() {
}
+ Connection connection;
+
public void setUp() throws SQLException {
switch (mode) {
case NET:
- url = "jdbc:hsqldb:hsql://localhost:4808/test";
+ url = "jdbc:h2:tcp://localhost:4808/test";
break;
case MEM:
- url = "jdbc:hsqldb:mem:test;sql.enforce_strict_size=true";
- server = new Server();
- server.setDatabaseName(0, "test");
- server.setDatabasePath(0, url);
- server.setLogWriter(new PrintWriter(System.out));
- server.setErrWriter(new PrintWriter(System.out));
- server.setTrace(false);
- server.setSilent(false);
- server.start();
-
+ url = "jdbc:h2:mem:test"+diff;
break;
case FILE:
url = "jdbc:hsqldb:file:test;sql.enforce_strict_size=true";
break;
}
-
- // try {
- // Class.forName(DRIVER_CLASS);
- // } catch (Exception e) {
- // e.printStackTrace();
- // System.out.println(this + ".setUp() error: " + e.getMessage());
- // }
- // Thread.yield();
- System.out.println(server.getState());
-
- int waitCount = 0;
- while (server.getState() != ServerConstants.SERVER_STATE_ONLINE
- && waitCount < 5) {
- try {
- waitCount++;
- Thread.sleep(1);
- } catch (InterruptedException e) {
- }
- }
+ connection = newConnection();
createTables();
}
public void tearDown() throws SQLException {
dropTables();
-
- if (mode == HsqlMode.MEM) {
- server.stop();
- server = null;
- }
+ connection.close();
}
Connection newConnection() throws SQLException {
- jdbcDriver driver = new jdbcDriver();
+ org.h2.Driver driver = Driver.load();
Properties props = new Properties();
props.setProperty("user", user);
props.setProperty("password", password);
return driver.connect(url, props);
-
- // return DriverManager.getConnection(url, user, password);
}
private void createTables() throws SQLException {
- Connection conn = newConnection();
- assertNotNull(conn);
+ assertNotNull(connection);
StringBuffer buf = new StringBuffer();
buf.append("CREATE TABLE logging_event (");
buf.append("timestmp BIGINT NOT NULL,");
@@ -120,7 +92,7 @@ public class DBAppenderTestFixture {
buf.append("caller_method VARCHAR(256), ");
buf.append("caller_line CHAR(4), ");
buf.append("event_id INT NOT NULL IDENTITY);");
- query(conn, buf.toString());
+ executeQuery(connection, buf.toString());
buf = new StringBuffer();
buf.append("CREATE TABLE logging_event_property (");
@@ -129,7 +101,7 @@ public class DBAppenderTestFixture {
buf.append("mapped_value LONGVARCHAR,");
buf.append("PRIMARY KEY(event_id, mapped_key),");
buf.append("FOREIGN KEY (event_id) REFERENCES logging_event(event_id));");
- query(conn, buf.toString());
+ executeQuery(connection, buf.toString());
buf = new StringBuffer();
buf.append("CREATE TABLE logging_event_exception (");
@@ -138,26 +110,24 @@ public class DBAppenderTestFixture {
buf.append("trace_line VARCHAR(256) NOT NULL,");
buf.append("PRIMARY KEY(event_id, i),");
buf.append("FOREIGN KEY (event_id) REFERENCES logging_event(event_id));");
- query(conn, buf.toString());
+ executeQuery(connection, buf.toString());
}
private void dropTables() throws SQLException {
- Connection conn = newConnection();
StringBuffer buf = new StringBuffer();
buf.append("DROP TABLE logging_event_exception IF EXISTS;");
- query(conn, buf.toString());
+ executeQuery(connection, buf.toString());
buf = new StringBuffer();
buf.append("DROP TABLE logging_event_property IF EXISTS;");
- query(conn, buf.toString());
+ executeQuery(connection, buf.toString());
buf = new StringBuffer();
buf.append("DROP TABLE logging_event IF EXISTS;");
- query(conn, buf.toString());
+ executeQuery(connection, buf.toString());
}
- private void query(Connection conn, String expression) throws SQLException {
-
+ private void executeQuery(Connection conn, String expression) throws SQLException {
Statement st = null;
st = conn.createStatement();
int i = st.executeUpdate(expression);
@@ -167,7 +137,5 @@ public class DBAppenderTestFixture {
st.close();
}
- public enum HsqlMode {
- MEM, FILE, NET;
- }
+
}
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderHSQLTest.java
similarity index 90%
rename from logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderTest.java
rename to logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderHSQLTest.java
index ef86c44..51117cd 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderHSQLTest.java
@@ -32,19 +32,19 @@ import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.classic.spi.LoggingEvent;
import ch.qos.logback.core.db.DriverManagerConnectionSource;
-public class DBAppenderTest {
+public class DBAppenderHSQLTest {
LoggerContext lc;
Logger logger;
DBAppender appender;
DriverManagerConnectionSource connectionSource;
- DBAppenderTestFixture dbAppenderTestFixture;
+ DBAppenderHSQLTestFixture dbAppenderHSQLTestFixture;
@Before
public void setUp() throws SQLException {
- dbAppenderTestFixture = new DBAppenderTestFixture();
- dbAppenderTestFixture.setUp();
+ dbAppenderHSQLTestFixture = new DBAppenderHSQLTestFixture();
+ dbAppenderHSQLTestFixture.setUp();
lc = new LoggerContext();
lc.setName("default");
@@ -54,10 +54,10 @@ public class DBAppenderTest {
appender.setContext(lc);
connectionSource = new DriverManagerConnectionSource();
connectionSource.setContext(lc);
- connectionSource.setDriverClass(DBAppenderTestFixture.HSQLDB_DRIVER_CLASS);
- connectionSource.setUrl(dbAppenderTestFixture.url);
- connectionSource.setUser(dbAppenderTestFixture.user);
- connectionSource.setPassword(dbAppenderTestFixture.password);
+ connectionSource.setDriverClass(DBAppenderHSQLTestFixture.HSQLDB_DRIVER_CLASS);
+ connectionSource.setUrl(dbAppenderHSQLTestFixture.url);
+ connectionSource.setUser(dbAppenderHSQLTestFixture.user);
+ connectionSource.setPassword(dbAppenderHSQLTestFixture.password);
connectionSource.start();
appender.setConnectionSource(connectionSource);
appender.start();
@@ -69,7 +69,7 @@ public class DBAppenderTest {
lc = null;
appender = null;
connectionSource = null;
- dbAppenderTestFixture.tearDown();
+ dbAppenderHSQLTestFixture.tearDown();
}
@Test
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderTestFixture.java b/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderHSQLTestFixture.java
similarity index 98%
rename from logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderTestFixture.java
rename to logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderHSQLTestFixture.java
index 46cfd2b..1f6e00f 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderTestFixture.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderHSQLTestFixture.java
@@ -25,7 +25,7 @@ import org.hsqldb.Server;
import org.hsqldb.ServerConstants;
import org.hsqldb.jdbcDriver;
-public class DBAppenderTestFixture {
+public class DBAppenderHSQLTestFixture {
public static final String HSQLDB_DRIVER_CLASS = "org.hsqldb.jdbcDriver";
// String serverProps;
@@ -37,7 +37,7 @@ public class DBAppenderTestFixture {
// boolean isNetwork = true;
HsqlMode mode = HsqlMode.MEM;
- public DBAppenderTestFixture() {
+ public DBAppenderHSQLTestFixture() {
}
public void setUp() throws SQLException {
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/db/PackageTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/db/PackageTest.java
index 6fdc4d3..869fe27 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/db/PackageTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/db/PackageTest.java
@@ -18,6 +18,6 @@ import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
-@SuiteClasses( {DBAppenderTest.class})
+@SuiteClasses( {DBAppenderHSQLTest.class})
public class PackageTest {
}
\ No newline at end of file
diff --git a/logback-core/src/main/java/ch/qos/logback/core/db/ConnectionSourceBase.java b/logback-core/src/main/java/ch/qos/logback/core/db/ConnectionSourceBase.java
index 55d8e8c..29a5dee 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/db/ConnectionSourceBase.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/db/ConnectionSourceBase.java
@@ -55,9 +55,9 @@ public abstract class ConnectionSourceBase extends ContextAwareBase implements C
supportsGetGeneratedKeys = util.supportsGetGeneratedKeys(meta);
supportsBatchUpdates = util.supportsBatchUpdates(meta);
dialectCode = DBUtil.discoverSQLDialect(meta);
- System.out.println("Driver name="+meta.getDriverName());
- System.out.println("Driver version="+meta.getDriverVersion());
- System.out.println("supportsGetGeneratedKeys="+supportsGetGeneratedKeys);
+ addInfo("Driver name="+meta.getDriverName());
+ addInfo("Driver version="+meta.getDriverVersion());
+ addInfo("supportsGetGeneratedKeys="+supportsGetGeneratedKeys);
} catch (SQLException se) {
addWarn("Could not discover the dialect to use.", se);
diff --git a/logback-core/src/main/java/ch/qos/logback/core/db/DBAppenderBase.java b/logback-core/src/main/java/ch/qos/logback/core/db/DBAppenderBase.java
index be8bc33..ed08712 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/db/DBAppenderBase.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/db/DBAppenderBase.java
@@ -50,7 +50,6 @@ public abstract class DBAppenderBase<E> extends AppenderBase<E> {
"DBAppender cannot function without a connection source");
}
- System.out.println(connectionSource.supportsGetGeneratedKeys());
sqlDialect = DBUtil
.getDialectFromCode(connectionSource.getSQLDialectCode());
if (getGeneratedKeysMethod() != null) {
diff --git a/pom.xml b/pom.xml
index 942e470..f56f9ec 100755
--- a/pom.xml
+++ b/pom.xml
@@ -94,9 +94,14 @@
<version>1.8.0.7</version>
</dependency>
<dependency>
- <groupId>postgresql</groupId>
- <artifactId>postgresql</artifactId>
- <version>8.4-701.jdbc4</version>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ <version>1.2.132</version>
+ </dependency>
+ <dependency>
+ <groupId>postgresql</groupId>
+ <artifactId>postgresql</artifactId>
+ <version>8.4-701.jdbc4</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
-----------------------------------------------------------------------
Summary of changes:
logback-classic/pom.xml | 6 ++
.../{DBAppenderTest.java => DBAppenderH2Test.java} | 25 +++--
...stFixture.java => DBAppenderH2TestFixture.java} | 90 ++++++-------------
...DBAppenderTest.java => DBAppenderHSQLTest.java} | 18 ++--
...Fixture.java => DBAppenderHSQLTestFixture.java} | 4 +-
.../ch/qos/logback/classic/db/PackageTest.java | 2 +-
.../qos/logback/core/db/ConnectionSourceBase.java | 6 +-
.../ch/qos/logback/core/db/DBAppenderBase.java | 1 -
pom.xml | 11 ++-
9 files changed, 73 insertions(+), 90 deletions(-)
copy logback-classic/src/test/java/ch/qos/logback/classic/db/{DBAppenderTest.java => DBAppenderH2Test.java} (89%)
copy logback-classic/src/test/java/ch/qos/logback/classic/db/{DBAppenderTestFixture.java => DBAppenderH2TestFixture.java} (64%)
rename logback-classic/src/test/java/ch/qos/logback/classic/db/{DBAppenderTest.java => DBAppenderHSQLTest.java} (90%)
rename logback-classic/src/test/java/ch/qos/logback/classic/db/{DBAppenderTestFixture.java => DBAppenderHSQLTestFixture.java} (98%)
hooks/post-receive
--
Logback: the generic, reliable, fast and flexible logging framework.
1
0

23 Mar '10
Starvation on AppenderBase.doAppend
-----------------------------------
Key: LBCORE-97
URL: http://jira.qos.ch/browse/LBCORE-97
Project: logback-core
Issue Type: Bug
Components: Appender
Affects Versions: 0.9.15
Reporter: Joern Huxhorn
Assignee: Logback dev list
Priority: Critical
Attachments: AppenderBaseLock.patch
The problem we are facing here is that several threads are trying to obtain the object monitor of the exact same resource, namely the Appender.
The assumption that multiple threads waiting for ownership of a monitor would receive the monitor in the order that they tried to acquire it is simply incorrect. This is documented behavior.
See the last paragraph of [1]:
"Likewise, no assumptions should be made about the order in which threads are granted ownership of a monitor or the order in which threads wake in response to the notify or notifyAll method. An excellent reference for these topics is Chapter 9, "Threads," in Joshua Bloch's book Effective Java Programming Language Guide. "
The documentation of Object.notifyAll() [2] states the following:
"[..] The awakened threads will compete in the usual manner with any other threads that might be actively competing to synchronize on this object; for example, the awakened threads enjoy no reliable privilege or disadvantage in being the next thread to lock this object."
The documentation in [5] also lists the following as a weak-spot of Built-in Synchronization in J2SE 1.4.x:
"No way to alter the semantics of a lock, for example, with respect to reentrancy, read versus write protection, or fairness."
In LBCORE-96 Ceki stated the following:
"Logback is using the standard synchronization mechanism found in the JDK. You are saying that that mechanism is unsuitable which, truth be told, sounds quite suspicious."
Yes, it's unsuitable in this situation because obtaining the object monitor is not guaranteed to be fair. It's not working in a "first come, first serve" manner. I assumed that, too, but it isn't the case. I had the exact same problem in Lilith some time ago because I made exactly this very same wrong assumption.
Fairness of object monitor lock acquisition seems to be logical and a "good thing" but it's not specified that way, and for good reasons.
Without fairness in place, the VM can optimize the execution of an application much better. A context switch is a costly operation for a CPU so performance is increased significantly if such a switch can be omitted.
Concerning a test-case, this would be pretty hardcore to implement since it's 100% implementation dependent. One implementation *may* handle the locking of object monitors fairly while others don't.
Therefore I'll try the following first:
I assume I could convince you that object monitor acquisition (OMA) is not fair.
If we take that for granted the following scenario should show my point:
There are 4 Threads (e.g. 4 Threads handling concurrent webapp-requests) that have one single chokepoint, the appender.
Since OMA isn't fair, it's possible that only some of those threads can work at all (see [3]). Exactly that is happening right now in our webapp running on a 4-core Solaris on JDK6.
My next assumption is that we both agree that this isn't acceptable behavior.
Logging should be handled "first come, first served" so that if Thread A is waiting to append an event and Thread B is waiting to append an event subsequently, the actual appending order should be A, then B.
This is currently not the case. It *may* be the case but there is no guarantee of it.
One could even argue that the logging system is working incorrectly (aside from the starvation problem) because events are appended in a different order than the actual execution of the logger call.
The only way to prevent this is the introduction of fairness into the locking process. The way to do this is to use ReentrantLock [4].
>From the ReentrantLock javadoc:
"The constructor for this class accepts an optional fairness parameter. When set true, under contention, locks favor granting access to the longest-waiting thread. Otherwise this lock does not guarantee any particular access order. Programs using fair locks accessed by many threads may display lower overall throughput (i.e., are slower; often much slower) than those using the default setting, but have smaller variances in times to obtain locks and guarantee lack of starvation."
This is exactly what is absolutely necessary for a logging framework.
Logging must *NOT* be able to introduce a starvation problem into a multi-threaded application! And it does exactly that right now.
I doubt that the performance will decrease in a significant manner due to the use of a fair ReentrantLock but even if this would be the case it would be necessary anyway.
Otherwise, appending simply isn't working correctly.
[1] http://java.sun.com/j2se/1.5.0/docs/guide/vm/thread-priorities.html
[2] http://java.sun.com/javase/6/docs/api/java/lang/Object.html#notifyAll()
[3] http://en.wikipedia.org/wiki/Starvation_(computing)
[4] http://java.sun.com/javase/6/docs/api/java/util/concurrent/locks/ReentrantL…
[5] http://java.sun.com/developer/technicalArticles/J2SE/concurrency/
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13
75

[GIT] Logback: the generic, reliable, fast and flexible logging framework. branch, master, updated. v0.9.18-109-g8ad8f15
by git-noreply@pixie.qos.ch 23 Mar '10
by git-noreply@pixie.qos.ch 23 Mar '10
23 Mar '10
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Logback: the generic, reliable, fast and flexible logging framework.".
The branch, master has been updated
via 8ad8f15265b86671678d40c6109245327ef1f9f7 (commit)
from 1903ec955f2575cdad61fa9a2df6ac20b4ac3638 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=8ad8f15265b86671678d40c6…
http://github.com/ceki/logback/commit/8ad8f15265b86671678d40c6109245327ef1f…
commit 8ad8f15265b86671678d40c6109245327ef1f9f7
Author: Ceki Gulcu <ceki(a)qos.ch>
Date: Tue Mar 23 09:34:21 2010 +0100
- upgrade to SLF4J 1.5.11
- document the timzezone option in %date
- minor edits
diff --git a/logback-examples/src/main/java/chapters/configuration/MyApp3.java b/logback-examples/src/main/java/chapters/configuration/MyApp3.java
index 2cc3199..99c8733 100644
--- a/logback-examples/src/main/java/chapters/configuration/MyApp3.java
+++ b/logback-examples/src/main/java/chapters/configuration/MyApp3.java
@@ -40,7 +40,7 @@ public class MyApp3 {
lc.reset();
configurator.doConfigure(args[0]);
} catch (JoranException je) {
- je.printStackTrace();
+ // StatusPrinter will handle this
}
StatusPrinter.printInCaseOfErrorsOrWarnings(lc);
diff --git a/logback-site/src/site/pages/manual/configuration.html b/logback-site/src/site/pages/manual/configuration.html
index d9f801a..5b5bf09 100644
--- a/logback-site/src/site/pages/manual/configuration.html
+++ b/logback-site/src/site/pages/manual/configuration.html
@@ -497,7 +497,7 @@ public class MyApp3 {
lc.reset();
configurator.doConfigure(args[0]);
} catch (JoranException je) {
- je.printStackTrace();
+ // StatusPrinter will handle this
}
StatusPrinter.printInCaseOfErrorsOrWarnings(lc);</b>
diff --git a/logback-site/src/site/pages/manual/layouts.html b/logback-site/src/site/pages/manual/layouts.html
index f91d654..99a2c74 100644
--- a/logback-site/src/site/pages/manual/layouts.html
+++ b/logback-site/src/site/pages/manual/layouts.html
@@ -576,6 +576,23 @@ WARN [main]: Message 2</p>
<td>20 oct. 2006;14:06:49.812 </td>
</tr>
</table>
+
+ <p>In addition to the date pattern, this converter admits a
+ second option as the timezone. Thus, the
+ '%date{HH:mm:ss.SSS,Australia/Perth} would print the time in
+ the time zone of Perth Australia, the worlds most isolated
+ city.
+ </p>
+
+ <p>Given that the comma ',' character is the option
+ separator, the pattern string [HH:mm:ss,SSS] will print the
+ time in the [SSS] time zone which does not exist. Thus, the
+ time will be printed in the default GMT timezone. If you
+ wish to include a comma in your date pattern, then simply
+ enclose the pattern between quotes. For example,
+ %date{<b>"</b>HH:mm:ss,SSS<b>"</b>}.
+ </p>
+
</td>
</tr>
diff --git a/pom.xml b/pom.xml
index 7f1e6ea..942e470 100755
--- a/pom.xml
+++ b/pom.xml
@@ -37,7 +37,7 @@
<properties>
<!-- slf4j.version property is used below, in
logback-classic/pom.xml and in setClasspath.cmd -->
- <slf4j.version>1.5.10</slf4j.version>
+ <slf4j.version>1.5.11</slf4j.version>
<consolePlugin.version>1.1.0</consolePlugin.version>
</properties>
-----------------------------------------------------------------------
Summary of changes:
.../main/java/chapters/configuration/MyApp3.java | 2 +-
.../src/site/pages/manual/configuration.html | 2 +-
logback-site/src/site/pages/manual/layouts.html | 17 +++++++++++++++++
pom.xml | 2 +-
4 files changed, 20 insertions(+), 3 deletions(-)
hooks/post-receive
--
Logback: the generic, reliable, fast and flexible logging framework.
1
0

[JIRA] Created: (LBCLASSIC-170) DbAppender discards all exception' details
by Tomasz Nurkiewicz (JIRA) 23 Mar '10
by Tomasz Nurkiewicz (JIRA) 23 Mar '10
23 Mar '10
DbAppender discards all exception' details
------------------------------------------
Key: LBCLASSIC-170
URL: http://jira.qos.ch/browse/LBCLASSIC-170
Project: logback-classic
Issue Type: Bug
Components: appender
Affects Versions: 0.9.18
Reporter: Tomasz Nurkiewicz
Assignee: Logback dev list
DbAppender uses a single table logging_event_exception to persist stack traces, inserting one row per each stack frame. Also, each row has its parent event id. Unfortunately this approach loses a lot of exception details, making it unable to fully recreate ILoggingEvent instance that was logged by the DbAppender. List of attributes that are missing:
* exception message
* exception class name
* exception root cause
Also logging_event_exception saves the result of ch.qos.logback.classic.spi.StackTraceElementProxy#toString (which refers to java.lang.StackTraceElement#toString) instead of saving each element of java.lang.StackTraceElement separately. Now, in order to recreate StackTraceElement instance one must parse (probably using regular expression) string saved in trace_line attribute.
My suggestion would be to create two tables:
* logging_event_throwable with columns: message, class_name and cause foreign key referencing other logging_event_throwable instance
* logging_event_stack_frame with columns: class_name, method, file, line and a foreign key referencing logging_event_throwable + indexing column
Also logging_event would have a optional foreign key to logging_event_throwable.
This modifications in database schema would allow to fully recreate ILoggingEvent. For backward compatibility ch.qos.logback.classic.db.DBAppender should remain untouched. The idea is to subclass it and override ch.qos.logback.classic.db.DBAppender#insertThrowable.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
3
5

[JIRA] Created: (LBCLASSIC-197) DBAppender support for SQLAnywhere database
by Michael Lynch (JIRA) 22 Mar '10
by Michael Lynch (JIRA) 22 Mar '10
22 Mar '10
DBAppender support for SQLAnywhere database
-------------------------------------------
Key: LBCLASSIC-197
URL: http://jira.qos.ch/browse/LBCLASSIC-197
Project: logback-classic
Issue Type: Improvement
Components: appender
Affects Versions: 0.9.18
Environment: SQLAnywhere 10.x
Reporter: Michael Lynch
Assignee: Logback dev list
Add Sybase SQLAnywhere dialect to logback-classic as SQLAnywhere JDBC driver does not support getGeneratedKeys.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
3
7

[GIT] Logback: the generic, reliable, fast and flexible logging framework. branch, master, updated. v0.9.18-108-g1903ec9
by git-noreply@pixie.qos.ch 22 Mar '10
by git-noreply@pixie.qos.ch 22 Mar '10
22 Mar '10
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Logback: the generic, reliable, fast and flexible logging framework.".
The branch, master has been updated
via 1903ec955f2575cdad61fa9a2df6ac20b4ac3638 (commit)
from 901a3a19b1f89939a2fed00c2cdc5ebd8c8bec77 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=1903ec955f2575cdad61fa9a…
http://github.com/ceki/logback/commit/1903ec955f2575cdad61fa9a2df6ac20b4ac3…
commit 1903ec955f2575cdad61fa9a2df6ac20b4ac3638
Author: Ceki Gulcu <ceki(a)qos.ch>
Date: Mon Mar 22 21:44:27 2010 +0100
- added H2 and Sybase support
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/h2.sql b/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/h2.sql
new file mode 100644
index 0000000..0ba314d
--- /dev/null
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/h2.sql
@@ -0,0 +1,35 @@
+# This SQL script creates the required tables by ch.qos.logback.classic.db.DBAppender.
+#
+# It is intended for HSQL databases. It has been tested on HSQL 1.8.07.
+
+DROP TABLE logging_event_exception IF EXISTS;
+DROP TABLE logging_event_property IF EXISTS;
+DROP TABLE logging_event IF EXISTS;
+
+CREATE TABLE logging_event (
+ timestmp BIGINT NOT NULL,
+ formatted_message LONGVARCHAR NOT NULL,
+ logger_name VARCHAR(256) NOT NULL,
+ level_string VARCHAR(256) NOT NULL,
+ thread_name VARCHAR(256),
+ reference_flag SMALLINT,
+ caller_filename VARCHAR(256),
+ caller_class VARCHAR(256),
+ caller_method VARCHAR(256),
+ caller_line CHAR(4),
+ event_id INT NOT NULL IDENTITY);
+
+
+CREATE TABLE logging_event_property (
+ event_id INT NOT NULL,
+ mapped_key VARCHAR(254) NOT NULL,
+ mapped_value LONGVARCHAR,
+ PRIMARY KEY(event_id, mapped_key),
+ FOREIGN KEY (event_id) REFERENCES logging_event(event_id));
+
+CREATE TABLE logging_event_exception (
+ event_id INT NOT NULL,
+ i SMALLINT NOT NULL,
+ trace_line VARCHAR(256) NOT NULL,
+ PRIMARY KEY(event_id, i),
+ FOREIGN KEY (event_id) REFERENCES logging_event(event_id));
\ No newline at end of file
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/sybaseSqlAnywhere.sql b/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/sybaseSqlAnywhere.sql
new file mode 100644
index 0000000..4daa77d
--- /dev/null
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/sybaseSqlAnywhere.sql
@@ -0,0 +1,38 @@
+-- This SQL script creates the required tables by ch.qos.logback.classic.db.DBAppender
+-- for Sybase SQLAnywhere. Tested on SQLAnywhere 10.0.1.
+
+DROP TABLE logging_event_property
+DROP TABLE logging_event_exception
+DROP TABLE logging_event
+
+CREATE TABLE logging_event
+(
+timestmp bigint NOT NULL,
+formatted_message LONG VARCHAR NOT NULL,
+logger_name VARCHAR(254) NOT NULL,
+level_string VARCHAR(254) NOT NULL,
+thread_name VARCHAR(254),
+reference_flag SMALLINT,
+caller_filename VARCHAR(254) NOT NULL,
+caller_class VARCHAR(254) NOT NULL,
+caller_method VARCHAR(254) NOT NULL,
+caller_line varCHAR(4) NOT NULL,
+event_id int NOT NULL DEFAULT AUTOINCREMENT,
+PRIMARY KEY(event_id)
+)
+
+CREATE TABLE logging_event_property
+ (
+ event_id int NOT NULL REFERENCES logging_event(event_id),
+ mapped_key VARCHAR(254) NOT NULL,
+ mapped_value LONG VARCHAR,
+ PRIMARY KEY(event_id, mapped_key)
+ )
+
+CREATE TABLE logging_event_exception
+ (
+ event_id int NOT NULL REFERENCES logging_event(event_id) ,
+ i SMALLINT NOT NULL,
+ trace_line VARCHAR(254) NOT NULL,
+ PRIMARY KEY(event_id, i)
+ )
diff --git a/logback-core/src/main/java/ch/qos/logback/core/db/dialect/H2Dialect.java b/logback-core/src/main/java/ch/qos/logback/core/db/dialect/H2Dialect.java
new file mode 100644
index 0000000..3e9c0f3
--- /dev/null
+++ b/logback-core/src/main/java/ch/qos/logback/core/db/dialect/H2Dialect.java
@@ -0,0 +1,28 @@
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.core.db.dialect;
+
+/**
+ * The HSQLDB dialect.
+ *
+ * @author Ceki Gülcü
+ */
+public class H2Dialect implements SQLDialect {
+ public static final String SELECT_CURRVAL = "CALL IDENTITY()";
+
+ public String getSelectInsertId() {
+ return SELECT_CURRVAL;
+ }
+
+}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/db/dialect/SybaseSqlAnywhereDialect.java b/logback-core/src/main/java/ch/qos/logback/core/db/dialect/SybaseSqlAnywhereDialect.java
new file mode 100644
index 0000000..6768e25
--- /dev/null
+++ b/logback-core/src/main/java/ch/qos/logback/core/db/dialect/SybaseSqlAnywhereDialect.java
@@ -0,0 +1,34 @@
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+
+package ch.qos.logback.core.db.dialect;
+
+public class SybaseSqlAnywhereDialect implements SQLDialect {
+
+ /**
+ * The Sybase SQLAnywhere Dialect
+ *
+ * Note that the dialect is not needed if your JDBC driver supports
+ * the getGeneratedKeys method introduced in JDBC 3.0 specification.
+ *
+ * @author Michael Lynch
+ */
+
+ public static final String SELECT_CURRVAL = "SELECT @@identity id";
+
+ public String getSelectInsertId() {
+ return SELECT_CURRVAL;
+ }
+
+}
-----------------------------------------------------------------------
Summary of changes:
.../classic/db/dialect/{hsqldb.sql => h2.sql} | 2 +-
.../classic/db/dialect/sybaseSqlAnywhere.sql | 38 ++++++++++++++++++++
.../dialect/{HSQLDBDialect.java => H2Dialect.java} | 2 +-
...BDialect.java => SybaseSqlAnywhereDialect.java} | 22 +++++++----
4 files changed, 54 insertions(+), 10 deletions(-)
copy logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/{hsqldb.sql => h2.sql} (94%)
create mode 100644 logback-classic/src/main/java/ch/qos/logback/classic/db/dialect/sybaseSqlAnywhere.sql
copy logback-core/src/main/java/ch/qos/logback/core/db/dialect/{HSQLDBDialect.java => H2Dialect.java} (93%)
copy logback-core/src/main/java/ch/qos/logback/core/db/dialect/{HSQLDBDialect.java => SybaseSqlAnywhereDialect.java} (61%)
hooks/post-receive
--
Logback: the generic, reliable, fast and flexible logging framework.
1
0