scala打印error,debug,info
1.以wordcount为例
package org.apache.spark.examples import org.apache.spark.examples.SparkPi.logger
import org.apache.spark.{SparkConf, SparkContext} object word { private val logger = org.slf4j.LoggerFactory.getLogger(this.getClass)
def main(args: Array[String]) {
val conf = new SparkConf()
.setAppName("WordCount").setMaster("local")
val sc = new SparkContext(conf)
logger.info("this is textFile1" )
println("this is textFile2print")
logger.error("this is textFile3err")
logger.warn("this is textFile4warn")
logger.debug("this is textFile5debug")
val lines = sc.textFile("E:\\spark_file\\wordcount.txt", )
val words = lines.flatMap { line => line.split(" ") }
val pairs = words.map { word => (word, ) }
val wordCounts = pairs.reduceByKey { _ + _ }
wordCounts.foreach(wordCount => println(wordCount._1 + " appeared " + wordCount._2 + " times."))
}
}
2.控制台输出结果:

scala打印error,debug,info的更多相关文章
- Solve Error Debug Assertion Failed Expression vector iterators incompatible Using PCL in Release Mode of VS2010
When using PCL 1.4.0 in the release mode building under VS2010, we might sometime get the error &quo ...
- scala打印九九乘法表的5种实现
使用scala打印九九乘法表,可以有多种实现方法,实现的过程充分的体现的scala语言的优势和巨大的简洁性和高效性, 下面我用了5种方法实现九九乘法表. 使用类似于java,c++等指令风格的的编程实 ...
- Scala Java Error: value filter is not a member of *
有时在Scala中调用Java的库,Java库会返回某些Java的集合或类型,必须经过一些转换才能正常使用. 否则有可能在编译的过程遇到这个错误. 错误字符串 下面是错误的主要信息. Scala Ja ...
- NodeJS学习笔记 进阶 (11)Nodejs 进阶:调试日志打印:debug模块
个人总结:读完这篇文章需要5分钟,讲解了debug模块的使用 摘选自网络 前言 在node程序开发中时,经常需要打印调试日志.用的比较多的是debug模块,比如express框架中就用到了.下文简单举 ...
- Objective-C与Swift下的自定义打印函数(Debug和Release)
1.Objective-C 在使用Objective-C进行开发的过程中,为了Debug会不断的设置打印函数.如下图是我们经常用的,用来测试监听方法的实现与否: NSLog(@"%s&quo ...
- idea 运行scala代码 报错:Exception in thread "main" java.lang.NoClassDefFoundError: scala/Predef$ java.lang.NoClassDefFoundError: scala/Function0 Error: A JNI error has occurred, please check your installati
各种报错信息如下: java.lang.NoClassDefFoundError: scala/Function0 at java.lang.Class.getDeclaredMethods0(Nat ...
- ZThread在Windows下打印若干DEBUG信息到console的原因
代码见这篇随笔 在Windows下的运行结果:ZThread打印了一堆东西(并不是我写的) 文件结构: 最开始我以为是编译选项没弄对,同样的代码放到Linux下编译,还是打印这些信息 注意我在Linu ...
- C++ error:Debug Assertion Failed.Expression:_BLOCK_TYPE_IS_VALID(phead->nBlock)
Debug Assertion Failed.Expression:_BLOCK_TYPE_IS_VALID(phead->nBlockUse) 关于上面这个错误,我在上一篇文章中的程序遇到过了 ...
- error: [debug/qrc_resource.cpp] Error 1
t在进行debug时,出现这个错误,去资源文件夹,用资源编辑器打开resource.qrc文件,查看是否有标红的资源文件. 如果有红色名称的资源文件,那么就是因为缺少该资源文件,导致的这个错误. 改正 ...
随机推荐
- 《C++ Primer Plus》学习笔记3
<C++ Primer Plus>学习笔记3 第8章 函数探幽 ============================================================== ...
- How can I pass data from Flask to JavaScript in a template?
https://stackoverflow.com/questions/11178426/how-can-i-pass-data-from-flask-to-javascript-in-a-templ ...
- HDU1114 Piggy-Bank —— DP 完全背包
题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=1114 Piggy-Bank Time Limit: 2000/1000 MS (Java/ ...
- YTU 2586: 填空题B-字画鉴别
2586: 填空题B-字画鉴别 时间限制: 1 Sec 内存限制: 128 MB 提交: 509 解决: 131 题目描述 注:本题只需要提交填写部分的代码,请按照C语言方式提交. 古玩店老板小勇 ...
- UltraEdit mac破解版
2018-01-17 增加18.00.0.19破解 去官网下载原载,先运行一次,再在终端里执行下面代码就可以破解完成! printf '\x31\xC0\xFF\xC0\xC3\x90' | dd s ...
- ACTION 关联表之间查询语句 SQL语句写法
/** EquUseRecord * @author cll * @return * @右边菜单中的使用记录操作 */ public String QueryAllEquUserecordAllInf ...
- Local Databases with SQLiteOpenHelper
Overview For maximum control over local data, developers can use SQLite directly by leveraging SQLit ...
- frameset 框架整体退出登录的问题
1 设置其他的页面都验证session,如果session不存在就跳转到 Login 页: 2 Login中添加下面的js代码: <script language="JavaScrip ...
- C# ListView 列宽调整 刷新
/*********************************************************************** * C# ListView 列宽调整 刷新 * 说明: ...
- [Usaco2015DEC] Breed Counting
[题目链接] https://www.lydsy.com/JudgeOnline/problem.php?id=4397 [算法] 树状数组 时间复杂度 : O(QlogN) [代码] #includ ...