1.需求:查看日志是否发送邮件成功

2.数据库中查到相关的id号

代码:cat -n test.log |grep "地形"  得到关键日志的行号

[**@app3.*s:/app/local/jboss/tw/log]$ cat -n server.log|grep '779571'
1933    2017-05-25 00:23:09,245 DEBUG [com.ticketweb.report.service.ReportManagementBean] Current scheduled report's saved report id: 779571

得到关键日志的行号,此时如果我想

查看这个关键字前10行和后10行的日志: cat -n server.log |tail -n +1933 |head -n 20

tail -n +1933 表示查询1933 行之后的日志

head -n 20 则表示在前面的查询结果里再查前20条记录

[*@app3.*cs:/app/local/jboss/tw/log]$ cat -n server.log|tail -n +1923|head -n 201923   2017-05-25 00:23:09,242 DEBUG [com.*.ReportManagementBean] Calling MailService.sendEmail(message) to send Email for scheduledReport id:6025411924   2017-05-25 00:23:09,242 DEBUG [com.*.ReportManagementBean] To:tcttemplate@gmail.com1925    2017-05-25 00:23:09,242 DEBUG [com.*.ReportManagementBean] CC:null1926  2017-05-25 00:23:09,242 DEBUG [com.*.ReportManagementBean] Subject:alam test 3 uk1927   2017-05-25 00:23:09,242 DEBUG [com.*.ReportManagementBean] Report sent by MailService.sendEmail(message).Please see attached for the reports.1928   2017-05-25 00:23:09,244 DEBUG [com.*.schedulable.ReportEmailSendHelper] Email sent on: 2017-05-25 00:23:09.2441929  2017-05-25 00:23:09,244 DEBUG [com.*.schedulable.ReportEmailSendHelper] Emailing report id: 602611 , name: alam master uk 111930    2017-05-25 00:23:09,245 DEBUG [com.*.ReportEmailSendHelper] Emailing starts on2017-05-25 00:23:09.2441931   2017-05-25 00:23:09,245 DEBUG [com.*.ReportManagementBean] Current scheduled report id: 6026111932  2017-05-25 00:23:09,245 DEBUG [com.*.ReportManagementBean] Current scheduled report's orgId: 41933 2017-05-25 00:23:09,245 DEBUG [com.*.ReportManagementBean] Current scheduled report's saved report id: 7795711934  2017-05-25 00:23:09,245 DEBUG [com.*.ReportManagementBean] Current scheduled report's saved report's eid: null1935    2017-05-25 00:23:09,246 DEBUG [com.*.ReportManagementBean] Generating the TemplateReportConfig by calling ReportConfigFactory.getConfig(...)1936    2017-05-25 00:23:09,270 DEBUG [com.*.ReportManagementBean] Initializing the TemplateReportConfig object...1937  2017-05-25 00:23:09,270 DEBUG [com.*.ReportManagementBean] The value of txDate_toDate has been cut off to the prev day mid night:2017-05-24+23:59:591938   2017-05-25 00:23:09,270 DEBUG [com.*.ReportManagementBean] The value of txDate_toDate has been cut off to the prev day mid night:2017-05-24+23:59:591939   2017-05-25 00:23:09,270 DEBUG [com.*.ReportManagementBean] The value of txDate_toDate has been cut off to the prev day mid night:2017-05-24+23:59:591940   2017-05-25 00:23:09,270 DEBUG [com.*.ReportManagementBean] saved report param name is: country saved report param value is GB1941   2017-05-25 00:23:09,270 DEBUG [com.*.ReportManagementBean] The value of txDate_toDate has been cut off to the prev day mid night:2017-05-24+23:59:591942   2017-05-25 00:23:09,270 DEBUG [com.*.ReportManagementBean] Initialized the TemplateReportConfig object successfully.

  

转载于:https://www.cnblogs.com/alamZ/p/6904272.html

linux 查看日志相关推荐

  1. linux查看日志的几种命令,Linux查看日志三种命令(转载)

    第一种:查看实时变化的日志(比较吃内存) 最常用的: tail -f filename (默认最后10行,相当于增加参数 -n 10) Ctrl+c 是退出tail命令 其他情况: tail -n 2 ...

  2. 【实施工程师】Linux查看日志后100行

    [实施工程师]Linux查看日志后100行 tail -f 实时查看日志文件tail -f 日志文件log tail - 100f 实时查看日志文件 后一百行tail -f -n 100 catali ...

  3. linux view查看日志命令,linux查看日志文件内容命令tail、cat、tac、head、echo、vi

    linux查看日志文件内容命令tail.cat.tac.head.echo tail -f test.log 你会看到屏幕不断有内容被打印出来. 这时候中断第一个进程Ctrl-C, --------- ...

  4. java查看日志命令_[Java教程]【Linux】linux查看日志文件内容命令tail、cat、tac、head、echo...

    [Java教程][Linux]linux查看日志文件内容命令tail.cat.tac.head.echo 0 2017-11-14 12:00:29 linux查看日志文件内容命令tail.cat.t ...

  5. linux view查看日志命令,【Linux】linux查看日志文件内容命令tail、cat、tac、head、echo...

    linux查看日志文件内容命令tail.cat.tac.head.echo tail -f test.log 你会看到屏幕不断有内容被打印出来. 这时候中断第一个进程Ctrl-C, --------- ...

  6. linux查看php日志命令,linux查看日志的三种命令是什么,linux查看进程命令

    linux查看日志的三种命令是什么Linux查看日志的三个命令是什么,linux查看日志有三个命令:1.查看实时更改日志,代码为[tail-f filename]:2.搜索关键字附近的日志代码为[ca ...

  7. linux查看日志文件内容命令tail、cat、tac、head、echo、vi

    linux查看日志文件内容命令tail.cat.tac.head.echo tail -f test.log 你会看到屏幕不断有内容被打印出来. 这时候中断第一个进程Ctrl-C, --------- ...

  8. linux查看日志的多种方法集合

    linux查看日志的多种方法集合 Linux查看日志的命令有多种: tail.cat.tac.head.echo等 tail 参数 命令格式: tail[必要参数][选择参数][文件] -f 循环读取 ...

  9. linux查看日志文件内容命令tail、cat、tac、head、echo

    当日志文件存储日志很大时,我们就不能用vi直接进去查看日志,需要Linux的命令去完成我们的查看任务. Log位置:/var/log/message 系统启动后的信息和错误日志,是Red Hat Li ...

  10. Linux查看日志命令(4种常见方式)

    第一种:查看实时变化的日志(比较吃内存) 最常用的: tail -f filename (默认最后10行,相当于增加参数 -n 10) Ctrl+c 是退出tail命令 其他情况: tail -n 2 ...

最新文章

  1. JavaScript 之 动态加载JS代码或JS文件
  2. android 存储不被垃圾清理,手机内存足够大,就不需要清理垃圾了?你错了!
  3. 飞鸽传书的这一新的通信方式采用云技术
  4. PHP 是生还是死?
  5. Mybatis与JDBC的对比超详细笔记
  6. Delphi XE2有什么新功能
  7. 滚动字幕特效大全代码 (转)
  8. 基于人工智能的智能化地理信息系统
  9. php项目代做,代做PHP开发技术程序、php网站代码代写
  10. 【高等数学】第二章 导数与微分——第一节 导数的概念
  11. 世界上最伟大的推销员
  12. 电脑装不上谷歌浏览器吗_索尼将在新电脑上提供谷歌浏览器
  13. Android 对话框(Dialogs)
  14. Win10+YOLOv4/v3用yolo_mark标记数据集 训练自己的模型
  15. 认知计算Cognitive Computing 各章总结
  16. arduino使用oled代码_Arduino提高篇04—U8g2库驱动OLED
  17. java oval 使用_java开源验证框架OVAL应用实例
  18. VMware虚拟机桥接方式上网
  19. 素描人物头像写生的基本规律是有哪些
  20. 【微信公众号】获取用户信息

热门文章

  1. 一支口红用了5年_用了7年微信才知道!原来微信隐藏5大实用功能,比app更好用...
  2. HTML语言中 blur()方法,jQuery的blur()方法怎么用?
  3. oracle自动结束连接,如何在Oracle8x中实现自动断开后再连接?
  4. [hystar整理]Entity Framework 教程
  5. 开源人工智能技术将改变一切
  6. Oracle的DBV工具
  7. 提取Unity游戏资源和脚本
  8. USACO全部月赛及GateWay数据
  9. UINavigationItem 设置UIBarButtonItem
  10. C# 图像编程 (1) 准备工作; 你好,空姐; 为空姐照片添加特效