Skip to content

Commit

Permalink
switch log4j from 1.2.x to 2.12.1, aws sdk from 1.11.28 to 1.11.700, …
Browse files Browse the repository at this point in the history
…jackson from 2.8.x to 2.10.3
  • Loading branch information
Marat Khusainov committed Apr 16, 2020
1 parent 93dd074 commit fef5145
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 160 deletions.
2 changes: 1 addition & 1 deletion bin/aws-kinesis-agent.Debian
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ RETVAL=0
# load any configs/environment from /etc/default/<name>
[ -e /etc/default/$DAEMON_NAME ] && . /etc/default/$DAEMON_NAME

export JVM_ARGS="$JVM_ARGS -Dlog4j.configuration=file://$LOG_CONFIG "
export JVM_ARGS="$JVM_ARGS -Dlog4j.configurationFile=file://$LOG_CONFIG "

# Export the settings
do_start () {
Expand Down
2 changes: 1 addition & 1 deletion bin/aws-kinesis-agent.RedHat
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ do_start () {
export AWS_ACCESS_KEY_ID
export AWS_SECRET_ACCESS_KEY
export AWS_DEFAULT_REGION
export JVM_ARGS="$JVM_ARGS -Dlog4j.configuration=file://$LOG_CONFIG "
export JVM_ARGS="$JVM_ARGS -Dlog4j.configurationFile=file://$LOG_CONFIG "

DAEMON_NAME=$DAEMON_NAME nohup runuser $AGENT_USER -s /bin/sh -c "$DAEMON_EXEC $AGENT_ARGS $@" > $INITLOGFILE 2>&1 &

Expand Down
2 changes: 1 addition & 1 deletion bin/aws-kinesis-agent.Ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ RETVAL=0
# load any configs/environment from /etc/default/<name>
[ -e /etc/default/$DAEMON_NAME ] && . /etc/default/$DAEMON_NAME

export JVM_ARGS="$JVM_ARGS -Dlog4j.configuration=file://$LOG_CONFIG "
export JVM_ARGS="$JVM_ARGS -Dlog4j.configurationFile=file://$LOG_CONFIG "

# Export the settings
do_start () {
Expand Down
44 changes: 33 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</licenses>

<properties>
<aws-java-sdk.version>1.11.28</aws-java-sdk.version>
<aws-java-sdk.version>1.11.700</aws-java-sdk.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -65,17 +65,27 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.8.11</version>
<version>2.10.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.8.11</version>
<version>2.10.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.10.3</version>
<version>2.10.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-cbor</artifactId>
<version>2.10.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>2.10.3</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
Expand Down Expand Up @@ -143,19 +153,31 @@
<version>3.4</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-1.2-api</artifactId>
<version>2.12.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.12.1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.12</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.12</version>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.12.1</version>
<exclusions>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.beust</groupId>
Expand Down Expand Up @@ -229,4 +251,4 @@
</plugins>
</build>

</project>
</project>
17 changes: 10 additions & 7 deletions setup
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,18 @@ download_dependencies() {
install -d ${dependencies_dir}

echo "Downloading dependencies ..."
aws_java_sdk_version="1.11.28"
aws_java_sdk_version="1.11.700"

remote_mvn_pkg="com.amazonaws:aws-java-sdk-core:${aws_java_sdk_version} \
com.amazonaws:aws-java-sdk-kinesis:${aws_java_sdk_version} \
com.amazonaws:aws-java-sdk-cloudwatch:${aws_java_sdk_version} \
com.amazonaws:aws-java-sdk-sts:${aws_java_sdk_version} \
com.amazonaws:aws-java-sdk-ec2:${aws_java_sdk_version} \
com.fasterxml.jackson.core:jackson-annotations:2.8.11 \
com.fasterxml.jackson.core:jackson-core:2.8.11 \
com.fasterxml.jackson.core:jackson-databind:2.8.11 \
com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:2.8.11 \
com.fasterxml.jackson.core:jackson-annotations:2.10.3\
com.fasterxml.jackson.core:jackson-core:2.10.3 \
com.fasterxml.jackson.core:jackson-databind:2.10.3 \
com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:2.10.3 \
com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.10.3 \
com.google.code.findbugs:jsr305:3.0.1 \
com.google.guava:guava:18.0 \
org.apache.httpcomponents:httpclient:4.5.1 \
Expand All @@ -122,9 +123,11 @@ download_dependencies() {
commons-logging:commons-logging-adapters:1.1 \
commons-logging:commons-logging-api:1.1 \
org.apache.commons:commons-lang3:3.4 \
log4j:log4j:1.2.17 \
org.apache.logging.log4j:log4j-1.2-api:2.12.1 \
org.apache.logging.log4j:log4j-api:2.12.1 \
org.apache.logging.log4j:log4j-core:2.12.1 \
org.apache.logging.log4j:log4j-slf4j-impl:2.12.1 \
org.slf4j:slf4j-api:1.7.12 \
org.slf4j:slf4j-log4j12:1.7.12 \
com.beust:jcommander:1.48 \
org.xerial:sqlite-jdbc:3.20.1 \
joda-time:joda-time:2.8.2 \
Expand Down

This file was deleted.

This file was deleted.

95 changes: 30 additions & 65 deletions support/log4j.xml
Original file line number Diff line number Diff line change
@@ -1,65 +1,30 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="FILE" class="org.apache.log4j.RollingFileAppender">
<errorHandler class="com.amazon.kinesis.streaming.agent.CustomLog4jFallbackErrorHandler">
<root-ref />
<appender-ref ref="FALLBACK" />
</errorHandler>
<param name="File" value="/var/log/aws-kinesis-agent/aws-kinesis-agent.log" />
<param name="Encoding" value="UTF-8" />
<param name="MaxBackupIndex" value="5" />
<param name="MaxFileSize" value="10485760" />
<param name="Append" value="true" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss.SSSZ} %X{hostname} (%t) %c [%p] %m%n" />
</layout>
</appender>
<appender name="FALLBACK" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="/tmp/fallback-aws-kinesis-agent.log" />
<param name="Encoding" value="UTF-8" />
<param name="MaxBackupIndex" value="2" />
<param name="MaxFileSize" value="2097152" />
<param name="Append" value="true" />
<layout class="com.amazon.kinesis.streaming.agent.CustomLog4jFallbackPatterLayout">
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss.SSSZ} %X{hostname} (%t) %c [%p] %m%n" />
</layout>
</appender>
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out" />
<param name="Encoding" value="UTF-8" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="LOG: %d{yyyy-MM-dd HH:mm:ss.SSSZ} %X{hostname} (%t) %c [%p] %m%n" />
</layout>
</appender>

<logger name="com.amazon.kinesis.streaming.agent.metrics.CWPublisherRunnable">
<level value="WARN" />
</logger>

<logger name="com.amazonaws.auth.AWS4Signer">
<level value="INFO" />
</logger>

<logger name="com.amazonaws.http">
<level value="INFO" />
</logger>

<logger name="com.amazonaws.internal">
<level value="INFO" />
</logger>

<logger name="com.amazonaws.request">
<level value="INFO" />
</logger>

<logger name="org.apache.http">
<level value="INFO" />
</logger>

<root>
<level value="INFO" />
<appender-ref ref="FILE" />
</root>
</log4j:configuration>
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Appenders>
<File name="FILE" fileName="/var/log/aws-kinesis-agent/aws-kinesis-agent.log" append="true">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSSZ} %X{hostname} (%t) %c [%p] %m%n" />
</File>
<File name="FALLBACK" fileName="/tmp/fallback-aws-kinesis-agent.log" append="true">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSSZ} %X{hostname} (%t) %c [%p] %m%n" />
</File>
<Console name="STDOUT" target="SYSTEM_OUT">
<PatternLayout pattern="LOG: %d{yyyy-MM-dd HH:mm:ss.SSSZ} %X{hostname} (%t) %c [%p] %m%n" />
</Console>
<Failover name="Failover" primary="FILE">
<Failovers>
<AppenderRef ref="FALLBACK"/>
</Failovers>
</Failover>
</Appenders>
<Loggers>
<Logger name="com.amazon.kinesis.streaming.agent.metrics.CWPublisherRunnable" level="info"> </Logger>
<Logger name="com.amazonaws.auth.AWS4Signer" level="info"> </Logger>
<Logger name="com.amazonaws.http" level="info"> </Logger>
<Logger name="com.amazonaws.internal" level="info"> </Logger>
<Logger name="com.amazonaws.request" level="info"> </Logger>
<Logger name="org.apache.http" level="info"> </Logger>
<Root level="info">
<AppenderRef ref="FILE"/>
</Root>
</Loggers>
</Configuration>

0 comments on commit fef5145

Please sign in to comment.