zoukankan      html  css  js  c++  java
  • linux 查看日志

    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 20
      1923	2017-05-25 00:23:09,242 DEBUG [com.*.ReportManagementBean] Calling MailService.sendEmail(message) to send Email for scheduledReport id:602541
      1924	2017-05-25 00:23:09,242 DEBUG [com.*.ReportManagementBean] To:tcttemplate@gmail.com
      1925	2017-05-25 00:23:09,242 DEBUG [com.*.ReportManagementBean] CC:null
      1926	2017-05-25 00:23:09,242 DEBUG [com.*.ReportManagementBean] Subject:alam test 3 uk
      1927	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.244
      1929	2017-05-25 00:23:09,244 DEBUG [com.*.schedulable.ReportEmailSendHelper] Emailing report id: 602611 , name: alam master uk 11
      1930	2017-05-25 00:23:09,245 DEBUG [com.*.ReportEmailSendHelper] Emailing starts on2017-05-25 00:23:09.244
      1931	2017-05-25 00:23:09,245 DEBUG [com.*.ReportManagementBean] Current scheduled report id: 602611
      1932	2017-05-25 00:23:09,245 DEBUG [com.*.ReportManagementBean] Current scheduled report's orgId: 4
      1933	2017-05-25 00:23:09,245 DEBUG [com.*.ReportManagementBean] Current scheduled report's saved report id: 779571
      1934	2017-05-25 00:23:09,245 DEBUG [com.*.ReportManagementBean] Current scheduled report's saved report's eid: null
      1935	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:59
      1938	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:59
      1939	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:59
      1940	2017-05-25 00:23:09,270 DEBUG [com.*.ReportManagementBean] saved report param name is: country saved report param value is GB
      1941	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:59
      1942	2017-05-25 00:23:09,270 DEBUG [com.*.ReportManagementBean] Initialized the TemplateReportConfig object successfully.
    

      

  • 相关阅读:
    软件开发面试
    jQuery插件
    基于消息的软件架构
    线程池的原理及实现(转)
    java实现生产者消费者问题(转)
    并发队列ConcurrentLinkedQueue和阻塞队列LinkedBlockingQueue用法(转)
    JAVA CAS原理深度分析(转)
    菜鸟nginx源码剖析 框架篇(一) 从main函数看nginx启动流程(转)
    Android中利用Handler实现消息的分发机制(三)
    char* 和char[]的差别
  • 原文地址:https://www.cnblogs.com/alamZ/p/6904272.html
Copyright © 2011-2022 走看看