Skip to content

Commit af6cec2

Browse files
committed
Using tailored log4j2 file for application
This removes the thread name, which is typically an implementation detail that most users will not need to see.
1 parent 2eaaf15 commit af6cec2

File tree

3 files changed

+50
-9
lines changed

3 files changed

+50
-9
lines changed

flux-cli/build.gradle

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,6 @@ application {
8888
applicationDefaultJvmArgs = ['--add-opens', 'java.base/java.nio=ALL-UNNAMED', '--add-opens', 'java.base/java.net=ALL-UNNAMED',
8989
'--add-opens', 'java.base/java.lang=ALL-UNNAMED', '--add-opens', 'java.base/java.util=ALL-UNNAMED',
9090
'--add-opens', 'java.base/java.util.concurrent=ALL-UNNAMED']
91-
92-
// For now, the log4j2 config we use for tests is suitable for production usage as well. So the log4j2 file is
93-
// included in the "conf" directory, which is included on the Flux classpath via the start-script.txt file.
94-
// Reference for this - https://docs.gradle.org/current/dsl/org.gradle.api.plugins.JavaApplication.html .
95-
applicationDistribution.from("src/test/resources") {
96-
include "log4j2.properties"
97-
into "conf"
98-
}
9991
}
10092

10193
// Modifies the application's start script to use our modified one that adds jars in the "./ext" folder to the classpath.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# The root logger with appender name
2+
rootLogger = INFO, STDOUT
3+
4+
# Assign STDOUT a valid appender & define its layout
5+
appender.console.name = STDOUT
6+
appender.console.type = Console
7+
appender.console.layout.type = PatternLayout
8+
#appender.console.layout.pattern = %d{yy/MM/dd HH:mm:ss} [%tn] %p %c: %m%n
9+
appender.console.layout.pattern = %d{yy/MM/dd HH:mm:ss} %c: %m%n
10+
11+
logger.marklogicclient.name=com.marklogic.client
12+
logger.marklogicclient.level=WARN
13+
logger.marklogicspark.name=com.marklogic.spark
14+
logger.marklogicspark.level=INFO
15+
16+
logger.flux.name=com.marklogic.flux
17+
logger.flux.level=INFO
18+
19+
# This logs write failures at the "warn" level in a verbose way.
20+
logger.writeBatcherImpl.name=com.marklogic.client.datamovement.impl.WriteBatcherImpl
21+
logger.writeBatcherImpl.level=ERROR
22+
23+
# The following both log errors at the ERROR level, but that is usually too verbose. The user can instead include
24+
# "--stacktrace" to see a single stacktrace when the tool catches an Exception.
25+
logger.sparkutils.name=org.apache.spark.util.Utils
26+
logger.sparkutils.level=FATAL
27+
logger.sparkexecutor.name=org.apache.spark.executor.Executor
28+
logger.sparkexecutor.level=FATAL
29+
logger.sparktasksetmanager.name=org.apache.spark.scheduler.TaskSetManager
30+
logger.sparktasksetmanager.level=FATAL
31+
32+
logger.sparksql.name=org.apache.spark.sql
33+
logger.sparksql.level=FATAL
34+
35+
logger.spark.name=org.apache.spark
36+
logger.spark.level=ERROR
37+
logger.sparkproject.name=org.sparkproject
38+
logger.sparkproject.level=WARN
39+
logger.hadoop.name=org.apache.hadoop
40+
logger.hadoop.level=ERROR
41+
logger.parquet.name=org.apache.parquet
42+
logger.parquet.level=WARN
43+
logger.orc.name=org.apache.orc
44+
logger.orc.level=WARN
45+
46+
# Jena has a fix to ignore "Unrecognized property - 'http://javax.xml.XMLConstants/property/accessExternalDTD'" errors
47+
# from Woodstox, but Hadoop has its own version of Woodstox that Jena isn't aware of. The error is not relevant for
48+
# a user, so it's suppressed here.
49+
logger.jenaxmlinput.name=org.apache.jena.util.JenaXMLInput
50+
logger.jenaxmlinput.level=FATAL

flux-cli/src/test/resources/log4j2.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ logger.marklogicclient.level=WARN
1212
logger.marklogicspark.name=com.marklogic.spark
1313
logger.marklogicspark.level=INFO
1414

15-
# Temporary name until we decide on a real name.
1615
logger.flux.name=com.marklogic.flux
1716
logger.flux.level=INFO
1817

0 commit comments

Comments
 (0)