docker知识: docker日志

docker知识: docker日志

Options:
      --details        Show extra details provided to logs
  -f, --follow         Follow log output
      --help           Print usage
      --since string   Show logs since timestamp
      --tail string    Number of lines to show from the end of the logs (default "all")
  -t, --timestamps     Show timestamps

显示时间戳

docker logs -f -t  insepctTomcat_1
2019-03-22T08:57:41.961027000Z     at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
2019-03-22T08:57:41.961817000Z     at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)
2019-03-22T08:57:41.962603000Z     at com.sun.proxy.$Proxy24.selectOne(Unknown Source)
2019-03-22T08:57:41.963379000Z     at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:166)
2019-03-22T08:57:41.964448000Z     at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:83)
2019-03-22T08:57:41.965432000Z     at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59)
2019-03-22T08:57:41.966337000Z     at com.sun.proxy.$Proxy33.getExitInfoByExitId(Unknown Source)
2019-03-22T08:57:41.967198000Z     at com.sgx.inspect.engine.service.impl.InputServiceImpl.getExitInfoByExitId(InputServiceImpl.java:64)
2019-03-22T08:57:41.968018000Z     at com.sgx.inspect.engine.CheckEngine.additionCheck(CheckEngine.java:180)
2019-03-22T08:57:41.968876000Z     at com.sgx.inspect.sup.service.SupCommonService.netCenterAutoIssueSupCheckResult(SupCommonService.java:48)

查看尾n行

docker logs -f --tail 10  insepctTomcat_1
    at com.sgx.inspect.engine.CheckEngine.additionCheck(CheckEngine.java:180)
    at com.sgx.inspect.sup.service.SupCommonService.netCenterAutoIssueSupCheckResult(SupCommonService.java:48)
    at com.sgx.inspect.engine.schedule.SupSchedule.lambda$run$0(SupSchedule.java:97)
    at java.util.ArrayList.forEach(ArrayList.java:1257)
    at com.sgx.inspect.engine.schedule.SupSchedule.run(SupSchedule.java:94)
    at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
    at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)

查看since多长时间的日志
相对时间

docker logs -f  -t --since 2019-03-22T09:30:12    insepctTomcat_1
2019-03-22T09:30:12.241144000Z [com.sgx.inspect.engine.schedule.SupSchedule] - 调度 30 天前的数据
2019-03-22T09:30:12.242340000Z [com.sgx.inspect.engine.schedule.SupSchedule] - 调度 CheckRecordId:201912301132060app21104746
2019-03-22T09:30:12.259525000Z [com.sgx.inspect.sup.service.SupCommonService] - checkRecordId:201912301132060app21104746
2019-03-22T09:30:12.261768000Z org.springframework.jdbc.BadSqlGrammarException:
2019-03-22T09:30:12.265476000Z ### Error querying database.  Cause: java.sql.SQLSyntaxErrorException: Unknown column 'ExitStation' in 'field list'
2019-03-22T09:30:12.266489000Z ### The error may exist in URL [jar:file:/usr/local/tomcat/webapps/prealtruckInspect/WEB-INF/lib/inspect-1.0.jar!/com/sgx/inspect/engine/dao/insp/mapping/InputFromCheckSysMapper.xml]

查看since多长时间的日志
绝对时间

docker logs -f  -t --since 1s    insepctTomcat_1
2019-03-22T09:30:12.241144000Z [com.sgx.inspect.engine.schedule.SupSchedule] - 调度 30 天前的数据
2019-03-22T09:30:12.242340000Z [com.sgx.inspect.engine.schedule.SupSchedule] - 调度 CheckRecordId:201912301132060app21104746
2019-03-22T09:30:12.259525000Z [com.sgx.inspect.sup.service.SupCommonService] - checkRecordId:201912301132060app21104746
2019-03-22T09:30:12.261768000Z org.springframework.jdbc.BadSqlGrammarException:
2019-03-22T09:30:12.265476000Z ### Error querying database.  Cause: java.sql.SQLSyntaxErrorException: Unknown column 'ExitStation' in 'field list'
2019-03-22T09:30:12.266489000Z ### The error may exist in URL [jar:file:/usr/local/tomcat/webapps/prealtruckInspect/WEB-INF/lib/inspect-1.0.jar!/com/sgx/inspect/engine/dao/insp/mapping/InputFromCheckSysMapper.xml]

你可能感兴趣的:(docker)