Macos Spark-如何为Spark的终端输出着色
当我运行它时,它可以成功地工作,但输出没有着色Macos Spark-如何为Spark的终端输出着色,macos,apache-spark,terminal,Macos,Apache Spark,Terminal,当我运行它时,它可以成功地工作,但输出没有着色 (/Users/me/bai/conda-envs/spark-mllib-kmeans) me@my-mbp spark-mllib-kmeans % spark-submit spark-helloWorld.py WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.apache.spark.
(/Users/me/bai/conda-envs/spark-mllib-kmeans) me@my-mbp spark-mllib-kmeans % spark-submit spark-helloWorld.py
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.spark.unsafe.Platform (file:/usr/local/Cellar/apache-spark/3.0.1/libexec/jars/spark-unsafe_2.12-3.0.1.jar) to constructor java.nio.DirectByteBuffer(long,int)
WARNING: Please consider reporting this to the maintainers of org.apache.spark.unsafe.Platform
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
20/12/22 12:18:33 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
20/12/22 12:18:34 INFO SparkContext: Running Spark version 3.0.1
20/12/22 12:18:34 INFO ResourceUtils: ==============================================================
20/12/22 12:18:34 INFO ResourceUtils: Resources for spark.driver:
20/12/22 12:18:34 INFO ResourceUtils: ==============================================================
20/12/22 12:18:34 INFO SparkContext: Submitted application: Simple App
...
我使用的是Spark 3.0.1版:
(base) me@my-mbp spark-mllib-kmeans % spark-shell --version
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.spark.unsafe.Platform (file:/usr/local/Cellar/apache-spark/3.0.1/libexec/jars/spark-unsafe_2.12-3.0.1.jar) to constructor java.nio.DirectByteBuffer(long,int)
WARNING: Please consider reporting this to the maintainers of org.apache.spark.unsafe.Platform
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Welcome to
____ __
/ __/__ ___ _____/ /__
_\ \/ _ \/ _ `/ __/ '_/
/___/ .__/\_,_/_/ /_/\_\ version 3.0.1
/_/
Using Scala version 2.12.10, OpenJDK 64-Bit Server VM, 14.0.1
Branch HEAD
Compiled by user ubuntu on 2020-08-28T08:58:35Z
Revision 2b147c4cd50da32fe2b4167f97c8142102a0510d
Url https://gitbox.apache.org/repos/asf/spark.git
Type --help for more information.
我在最新的Mac OS上使用默认的Mac终端程序:
% uname -a
Darwin my-mbp.lan 20.2.0 Darwin Kernel Version 20.2.0: Wed Dec 2 20:39:59 PST 2020; root:xnu-7195.60.75~1/RELEASE_X86_64 x86_64
我希望看到不同颜色的日志语句级别(WARN/INFO/ERROR)。也许可以使用其他颜色来区分spark framework的输出和我的应用程序的输出
考虑到有这么多的框架级输出,并且由于框架问题而发出警告的噪音,我希望更好地使用颜色可以帮助我更快地扫描输出
有没有简单的解决办法
我在本机Mac终端和MS VSC集成终端中都看到了这种行为
我看到了输出行:
Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
我知道我可以在这里创建然后编辑log4j配置文件,所以也许我只需要log4j配置文件的配置来着色所有输出
% cd $SPARK_HOME/conf
% cp log4j.properties.template log4j.properties
我收到了相同的警告,但运行正常,没有错误。我收到了相同的警告,但运行正常,没有错误。我的代码也运行正常。正是输出警告/错误没有着色的方式困扰着我。我正在寻找一种使输出着色的方法。我的代码也可以运行。正是输出警告/错误没有着色的方式困扰着我。我在寻找一种使输出着色的方法。