Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request couchbase#11 from yuetang95/master
Browse files Browse the repository at this point in the history
migrate log4j 1.2.x to log4j 2.13.3
  • Loading branch information
YueTang-Vanessa authored Dec 15, 2020
2 parents cb10182 + 40bf406 commit 85ca893
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 40 deletions.
4 changes: 2 additions & 2 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ server binary. By default it is set to _/usr/bin/memcached_.

-Dserver.version=version_of_testing_server

This argument is used to specify the version of your testing server. Currently supported memcached versions by Elasticache are _1.4.5_, _1.4.14_, _1.4.24_.
By default it is set to _1.4.24_.
This argument is used to specify the version of your testing server. Currently supported memcached versions by Elasticache are _1.4.5_, _1.4.14_, _1.4.24_, _1.5.10_, _1.5.16_.
By default it is set to _1.5.16_.

-Dtest.type=ci

Expand Down
21 changes: 21 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Security Policy

## Supported Versions

Use this section to tell people about which versions of your project are
currently being supported with security updates.

| Version | Supported |
| ------- | ------------------ |
| 5.1.x | :white_check_mark: |
| 5.0.x | :x: |
| 4.0.x | :white_check_mark: |
| < 4.0 | :x: |

## Reporting a Vulnerability

Use this section to tell people how to report a vulnerability.

Tell them where to go, how often they can expect to get an update on a
reported vulnerability, what to expect if the vulnerability is accepted or
declined, etc.
4 changes: 2 additions & 2 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@
<property name="test.type" value="unit"/>

<!--integration test related properties -->
<property name="client.mode" value="Dynamic"/>
<property name="client.mode" value="Static"/>
<property name="server.address_v4" value="127.0.0.1"/>
<property name="server.address_v6" value="::1"/>
<property name="server.bin" value="/usr/bin/memcached"/>
<property name="server.port_number" value="11211"/>
<property name="server.version" value="1.4.24"/>
<property name="server.version" value="1.5.16"/>
<property name="test.type" value="unit"/>

<!--this is the naming policy for artifacts we want pulled down-->
Expand Down
4 changes: 2 additions & 2 deletions ivy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ SOFTWARE.
</publications>

<dependencies defaultconfmapping="sources->sources(),%->default" defaultconf="default,sources">
<dependency org="log4j" name="log4j" rev="${log4j.version}"
conf="common->master" />
<dependency org="org.apache.logging.log4j" name="log4j-api" rev="2.13.3" conf="common->master" />
<dependency org="org.apache.logging.log4j" name="log4j-core" rev="2.13.3" conf="common->master" />
<dependency org="jmock" name="jmock" rev="${jmock.version}"
conf="common->master" />
<dependency org="junit" name="junit" rev="${junit.version}"
Expand Down
24 changes: 18 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,29 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.amazonaws</groupId>
<artifactId>elasticache-java-cluster-client</artifactId>
<version>1.1.2</version>
<name>ElastiCacheJavaClusterClient</name>
<version>1.1.3</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>6</source>
<target>6</target>
</configuration>
</plugin>
</plugins>
</build>
<name>ElastiCacheJavaClusterClient</name>
<description>Amazon ElastiCache Cluster Client is an enhanced Java library to connect to ElastiCache clusters. This client library has been built upon Spymemcached and is released under the Apache 2.0 License.</description>
<url>https://aws.amazon.com/documentation/elasticache/</url>
<url>https://aws.amazon.com/documentation/elasticache/</url>

<dependencies>
<!-- Optional Dependencies at Runtime -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-1.2-api</artifactId>
<version>2.13.3</version>
<optional>true</optional>
</dependency>
<dependency>
Expand Down
4 changes: 3 additions & 1 deletion src/it/java/net/spy/memcached/TestConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ public final class TestConfig {
public static enum engineTypeEnum {
V_1_4_24 ("1.4.24", true),
V_1_4_14 ("1.4.14", true),
V_1_4_5 ("1.4.5", false);
V_1_4_5 ("1.4.5", false),
V_1_5_10 ("1.5.10", true),
V_1_5_16 ("1.5.16", true);
private String version;
private boolean setConfigSupported;
engineTypeEnum(String version, boolean setConfigSupported) {
Expand Down
55 changes: 28 additions & 27 deletions src/main/java/net/spy/memcached/compat/log/Log4JLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@

package net.spy.memcached.compat.log;

import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

/**
* Logging implementation using <a
Expand All @@ -42,7 +43,7 @@ public Log4JLogger(String name) {
super(name);

// Get the log4j logger instance.
l4jLogger = Logger.getLogger(name);
l4jLogger = LogManager.getLogger(name);
}

@Override
Expand All @@ -69,33 +70,33 @@ public boolean isInfoEnabled() {
*/
@Override
public void log(Level level, Object message, Throwable e) {
org.apache.log4j.Level pLevel = org.apache.log4j.Level.DEBUG;
org.apache.logging.log4j.Level pLevel = org.apache.logging.log4j.Level.DEBUG;

switch (level == null ? Level.FATAL : level) {
case TRACE:
pLevel = org.apache.log4j.Level.TRACE;
break;
case DEBUG:
pLevel = org.apache.log4j.Level.DEBUG;
break;
case INFO:
pLevel = org.apache.log4j.Level.INFO;
break;
case WARN:
pLevel = org.apache.log4j.Level.WARN;
break;
case ERROR:
pLevel = org.apache.log4j.Level.ERROR;
break;
case FATAL:
pLevel = org.apache.log4j.Level.FATAL;
break;
default:
// I don't know what this is, so consider it fatal
pLevel = org.apache.log4j.Level.FATAL;
l4jLogger.log("net.spy.compat.log.AbstractLogger", pLevel, "Unhandled "
+ "log level: " + level + " for the following message", null);
case TRACE:
pLevel = org.apache.logging.log4j.Level.TRACE;
break;
case DEBUG:
pLevel = org.apache.logging.log4j.Level.DEBUG;
break;
case INFO:
pLevel = org.apache.logging.log4j.Level.INFO;
break;
case WARN:
pLevel = org.apache.logging.log4j.Level.WARN;
break;
case ERROR:
pLevel = org.apache.logging.log4j.Level.ERROR;
break;
case FATAL:
pLevel = org.apache.logging.log4j.Level.FATAL;
break;
default:
// I don't know what this is, so consider it fatal
pLevel = org.apache.logging.log4j.Level.FATAL;
String logMessage = String.format("Unhandled log level: %s for the following message", level);
l4jLogger.log(pLevel, logMessage, (Throwable) null);
}
l4jLogger.log("net.spy.compat.log.AbstractLogger", pLevel, message, e);
l4jLogger.log( pLevel, message, e );
}
}

0 comments on commit 85ca893

Please sign in to comment.