Skip to content

Commit d495514

Browse files
committed
Log4j v2 replaces the out-dated log4j v1
1 parent 1b165e2 commit d495514

77 files changed

Lines changed: 409 additions & 385 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.classpath

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
<classpathentry kind="lib" path="libs/sapdbc-7_6_00_30_5567.jar"/>
3131
<classpathentry kind="lib" path="libs/db2jcc_license_cu.jar"/>
3232
<classpathentry kind="lib" path="libs/db2jcc4.jar"/>
33-
<classpathentry kind="lib" path="libs/log4j-1.2.15.jar" sourcepath="libs/log4j-1.2.15-src.zip"/>
3433
<classpathentry kind="lib" path="libs/jgoodies-looks-2.4.2.jar"/>
3534
<classpathentry kind="lib" path="libs/tinylaf.jar"/>
3635
<classpathentry kind="lib" path="libs/vertica_4.1.7_jdk_5.jar"/>
@@ -41,5 +40,7 @@
4140
<classpathentry kind="lib" path="libs/postgresql-42.1.1.jar"/>
4241
<classpathentry kind="lib" path="libs/ojdbc7.jar"/>
4342
<classpathentry kind="lib" path="libs/mysql-connector-java-8.0.25.jar"/>
43+
<classpathentry kind="lib" path="libs/log4j-api-2.17.1.jar" sourcepath="libs/log4j-api-2.17.1-sources.jar"/>
44+
<classpathentry kind="lib" path="libs/log4j-core-2.17.1.jar" sourcepath="libs/log4j-core-2.17.1-sources.jar"/>
4445
<classpathentry kind="output" path="classes"/>
4546
</classpath>

libs/log4j-1.2.15.jar

-383 KB
Binary file not shown.

libs/log4j-api-2.17.1-sources.jar

260 KB
Binary file not shown.

libs/log4j-api-2.17.1.jar

295 KB
Binary file not shown.

libs/log4j-core-2.17.1-sources.jar

1.24 MB
Binary file not shown.

libs/log4j-core-2.17.1.jar

1.71 MB
Binary file not shown.

src/main/java/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20.8
1+
21.0

src/main/java/dbtools/CallableStatementDefinition.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
import java.sql.SQLException;
66
import java.util.ArrayList;
77

8-
import org.apache.log4j.Logger;
8+
import org.apache.logging.log4j.Logger;
9+
import org.apache.logging.log4j.LogManager;
910

1011

1112
/**
@@ -14,7 +15,7 @@
1415
*/
1516
public abstract class CallableStatementDefinition extends PreparedStatementDefinition {
1617

17-
private static final Logger logger = Logger.getLogger(CallableStatementDefinition.class);
18+
private static final Logger logger = LogManager.getLogger(CallableStatementDefinition.class);
1819

1920
protected CallableStatement cs;
2021
private ArrayList<OutParameter> outParams = new ArrayList<OutParameter>();

src/main/java/dbtools/DatabaseSession.java

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,16 @@
1313
import java.util.Properties;
1414
import java.util.StringTokenizer;
1515

16-
import org.apache.log4j.Level;
17-
import org.apache.log4j.Logger;
16+
import org.apache.logging.log4j.LogManager;
17+
import org.apache.logging.log4j.Logger;
18+
1819

1920
/**
2021
* Encapsulate a complete database.
2122
*/
2223
public class DatabaseSession {
2324

24-
private static Logger staticLogger = Logger.getLogger(DatabaseSession.class);
25+
private static Logger staticLogger = LogManager.getLogger(DatabaseSession.class);
2526
private Logger currentLogger = staticLogger;
2627

2728
/* id to provide access to multiple sessions */
@@ -154,20 +155,6 @@ public long getIdleTime() {
154155
}
155156
}
156157

157-
/**
158-
* set debug-mode
159-
* @param debug=true if additional output by the activities of database
160-
* @deprecated
161-
*/
162-
@Deprecated
163-
public void setDebug(boolean debug_loc) {
164-
if (debug_loc) {
165-
currentLogger.setLevel(Level.DEBUG);
166-
} else {
167-
currentLogger.setLevel(Level.INFO);
168-
}
169-
}
170-
171158
/**
172159
* marks this session as free for further usage
173160
* this method should only be used in class DatabaseSessionPool

src/main/java/dbtools/DatabaseSessionPool.java

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,17 @@
1313
import javax.management.MBeanServer;
1414
import javax.management.ObjectName;
1515

16-
import org.apache.log4j.Appender;
17-
import org.apache.log4j.Logger;
16+
import org.apache.logging.log4j.LogManager;
17+
import org.apache.logging.log4j.Logger;
18+
import org.apache.logging.log4j.core.Appender;
1819

1920
/**
2021
* A database pool with static access and config methods which can be used in standalone applications.
2122
* @author Jan Lolling
2223
*/
2324
public class DatabaseSessionPool {
2425

25-
private static final Logger logger = Logger.getLogger(DatabaseSessionPool.class);
26+
private static final Logger logger = LogManager.getLogger(DatabaseSessionPool.class);
2627
private static final Vector<DatabaseSession> pool = new Vector<DatabaseSession>();
2728
private static String lastErrorMessage = null;
2829
private static final Object monitor = new Object();
@@ -45,26 +46,6 @@ public class DatabaseSessionPool {
4546

4647
private DatabaseSessionPool() {}
4748

48-
/**
49-
* add an appender only when appender is not already attached
50-
* @param appender appender to add
51-
*/
52-
public static void addAppender(Appender appender) {
53-
if (logger.isAttached(appender) == false) {
54-
logger.addAppender(appender);
55-
}
56-
}
57-
58-
public static void removeAppender(Appender appender) {
59-
if (logger.isAttached(appender)) {
60-
logger.removeAppender(appender);
61-
}
62-
}
63-
64-
public static void removeAllAppenders() {
65-
logger.removeAllAppenders();
66-
}
67-
6849
private static void error(String message, Exception e) {
6950
if (message == null) {
7051
message = "undeclared error";
@@ -432,7 +413,7 @@ private static class CheckPoolTask extends TimerTask {
432413
/**
433414
* Logger for this class
434415
*/
435-
private static final Logger logger = Logger.getLogger(CheckPoolTask.class);
416+
private static final Logger logger = LogManager.getLogger(CheckPoolTask.class);
436417

437418
public void run() {
438419
if (checkInProcess == false) {

0 commit comments

Comments
 (0)