Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HIVE-28417: Bump Log4j2 to 2.24.3 #5636

Merged
merged 1 commit into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions data/conf/hive-log4j2.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

status = INFO
name = HiveLog4j2Test
packages = org.apache.hadoop.hive.ql.log

# list of properties
property.hive.log.level = DEBUG
Expand All @@ -25,9 +23,6 @@ property.hive.log.dir = ${sys:test.tmp.dir}/log
property.hive.log.file = hive.log
property.hive.test.console.log.level = INFO

# list of all appenders
appenders = console, DRFA

# console appender
appender.console.type = Console
appender.console.name = console
Expand All @@ -49,9 +44,6 @@ appender.DRFA.policies.time.modulate = true
appender.DRFA.strategy.type = DefaultRolloverStrategy
appender.DRFA.strategy.max = 30

# list of all loggers
loggers = HadoopIPC, HadoopSecurity, Hdfs, HdfsServer, HadoopMetrics2, Mortbay, Yarn, YarnServer, Tez, HadoopConf, Zookeeper, ServerCnxn, NIOServerCnxn, ClientCnxn, ClientCnxnSocket, ClientCnxnSocketNIO, DataNucleus, Datastore, JPOX, Operator, Serde2Lazy, ObjectStore, CalcitePlanner, AmazonAws, ApacheHttp, Thrift, Jetty, BlockStateChange, swo, CBORuleLogger

logger.HadoopIPC.name = org.apache.hadoop.ipc
logger.HadoopIPC.level = WARN

Expand Down Expand Up @@ -128,7 +120,7 @@ logger.CBORuleLogger.filter.marker.type = MarkerFilter
logger.CBORuleLogger.filter.marker.marker = FULL_PLAN
# Change filter to ACCEPT, to see the produced plan after every rule invocation using the EXPLAIN CBO format
logger.CBORuleLogger.filter.marker.onMatch = DENY
logger.CBORuleLogger.filter.marker.onMisMatch = NEUTRAL
logger.CBORuleLogger.filter.marker.onMismatch = NEUTRAL

logger.AmazonAws.name=com.amazonaws
logger.AmazonAws.level = INFO
Expand Down
3 changes: 1 addition & 2 deletions llap-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,8 @@
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<artifactId>log4j-core-test</artifactId>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it -test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change upgrades from 2.18.0 to 2.24.3.

Until 2.20.x, log4j-core provided the tests jar as well. That was the tests classifier that you see below. It was at line 372.

2.18 jars: https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-core/2.18.0/

At 2.20, they rearranged their packaging strategy. They started to provide different jar files and also, moved some namespaces as well.
The log4j-core-test artifact that you see means now we are using the artifact that log4j created to publish the test jars separately: https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-core/2.24.3/

<version>${log4j2.version}</version>
<classifier>tests</classifier>
<scope>test</scope>
<exclusions>
<exclusion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@
import org.apache.tez.common.security.TokenCache;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.Marker;
import org.slf4j.MDC;
import org.slf4j.Marker;
import org.slf4j.impl.StaticMarkerBinder;

import java.io.IOException;
import java.util.Collections;
Expand All @@ -70,7 +71,7 @@ public class QueryTracker extends AbstractService {

private static final Logger LOG = LoggerFactory.getLogger(QueryTracker.class);
private static final Marker QUERY_COMPLETE_MARKER =
new Log4jMarker(new Log4jQueryCompleteMarker());
new Log4jMarker(StaticMarkerBinder.getSingleton().getMarkerFactory(), new Log4jQueryCompleteMarker());

/// Shared singleton MetricsSource instance for all DAG locks
private static final MetricsSource LOCK_METRICS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.apache.hadoop.security.token.Token;
import org.apache.hive.testutils.junit.extensions.DoNothingTCPServer;
import org.apache.hive.testutils.junit.extensions.DoNothingTCPServerExtension;
import org.apache.logging.log4j.junit.LoggerContextSource;
import org.apache.logging.log4j.core.test.junit.LoggerContextSource;
import org.apache.tez.common.security.TokenCache;

import org.junit.jupiter.api.Test;
Expand Down
3 changes: 1 addition & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
<!-- Leaving libfb303 at 0.9.3 regardless of libthrift: As per THRIFT-4613 The Apache Thrift project does not publish items related to fb303 at this point -->
<libfb303.version>0.9.3</libfb303.version>
<libthrift.version>0.16.0</libthrift.version>
<log4j2.version>2.18.0</log4j2.version>
<log4j2.version>2.24.3</log4j2.version>
<mariadb.version>2.5.0</mariadb.version>
<mssql.version>6.2.1.jre8</mssql.version>
<mysql.version>8.2.0</mysql.version>
Expand Down Expand Up @@ -1802,7 +1802,6 @@
<log4j.configurationFile>${test.log4j.scheme}${test.conf.dir}/hive-log4j2.properties</log4j.configurationFile>
<hive.test.console.log.level>${test.console.log.level}</hive.test.console.log.level>
<hive.cluster.id>hive-test-cluster-id-cli</hive.cluster.id>
<log4j.debug>true</log4j.debug>
<!-- don't dirty up /tmp -->
<java.io.tmpdir>${test.tmp.dir}</java.io.tmpdir>
<!-- Hadoop's minidfs class uses this -->
Expand Down
8 changes: 6 additions & 2 deletions standalone-metastore/metastore-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -418,9 +418,13 @@
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<artifactId>log4j-core-test</artifactId>
<version>${log4j2.version}</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.config.LoggerConfig;
import org.apache.logging.log4j.test.appender.ListAppender;
import org.apache.logging.log4j.core.test.appender.ListAppender;
import org.apache.thrift.TException;
import org.hamcrest.core.IsNot;
import org.junit.After;
Expand Down
2 changes: 1 addition & 1 deletion standalone-metastore/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
<junit.vintage.version>5.11.2</junit.vintage.version>
<libfb303.version>0.9.3</libfb303.version>
<libthrift.version>0.16.0</libthrift.version>
<log4j2.version>2.18.0</log4j2.version>
<log4j2.version>2.24.3</log4j2.version>
<mockito-core.version>3.4.4</mockito-core.version>
<orc.version>1.9.4</orc.version>
<protobuf.version>3.25.5</protobuf.version>
Expand Down
Loading