spark 如何设置日志级别
1、Spark-core的日志配置文件:log4j-defaults.propertie

4、全局应用设置:针对spark所有应用,可以Java工程目录中新建/src/main/resources目录,把log4j.properties放置该目录

5、log4j.propert坡纠课柩ies生成:1. Spark中conf默认配置文件是log4j.properties.te罪焐芡拂mplate,可以将其改名为log4j.properties;2. 将Spark-core包中的log4j-default.properties内容复制到log4j.properties文件。#log4j内容如下#Seteverythingtobeloggedtotheconsolelog4j.rootCategory=WARN,consolelog4j.appender.console=org.apache.log4j.ConsoleAppenderlog4j.appender.console.target=System.errlog4j.appender.console.layout=org.apache.log4j.PatternLayoutlog4j.appender.console.layout.ConversionPattern=%d{yy/MM/ddHH:mm:ss}%p%c{1}:%m%n#Settingstoquietthirdpartylogsthataretooverboselog4j.logger.org.spark-project.jetty=WARNlog4j.logger.org.spark-project.jetty.util.component.AbstractLifeCycle=ERRORlog4j.logger.org.apache.spark.repl.SparkIMain$exprTyper=INFOlog4j.logger.org.apache.spark.repl.SparkILoop$SparkILoopInterpreter=INFOlog4j.logger.org.apache.parquet=ERRORlog4j.logger.parquet=ERROR#SPARK-9183:SettingstoavoidannoyingmessageswhenlookingupnonexistentUDFsinSparkSQLwithHivesupportlog4j.logger.org.apache.hadoop.hive.metastore.RetryingHMSHandler=FATALlog4j.logger.org.apache.hadoop.hive.ql.exec.FunctionRegistry=ERROR
6、在开发工程中,我们可以设置日志级别为WARN,即:log4j.rootCategory=WARN, console在生产环境可以配置成ERRORlog4j.rootCategory=ERROR