编写程序(linux上运行)
1.新建一个maven工程
1.1 建好后,在项目上右击 --> Add Framework Support --> 勾选scala
1.2 在src/main下新建一个directory (scala)–> 点击scala,右键 --> Mark Directory AS --> Sources Root
2.日志文件配置(设置只打印Error级别的日志)
2.1 在src/main/resources下新建 --> File(名为log4j.properties)
2.2 添加配置信息
log4j.rootCategory=ERROR, console
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.target=System.err
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d{
yy/MM/dd HH:mm:ss} %p %c{
1}: %m%n
# Set the default spark-shell log level to ERROR. When running the spark-shell, the
# log level for this class is used to overwrite the root logger's log level, so that
# the user can have different defaults for the shell and regular Spark apps.
log4j.logger.org.apache.spark.repl.Main=ERROR
# Settings to quiet third party logs that are too verbose
log4j.logger.org.spark_project.jetty=ERROR
log4j.logger.org.spark_project.jetty.util.component.AbstractLifeCycle=ERROR
log4j.logger.org.apache