#根据系统时间找日志文件 def swich_file(str,day_c):# statinfo = os.stat(str)statinfo = os.path.getctime(str)timeStruct = time.localtime(statinfo)tm_year = time.localtime(statinfo).tm_year-time.localtime(time.time()).tm_yeartm_mon = time.localtime(statinfo).tm_mon-time.localtime(time.time()).tm_montm_mday = time.localtime(statinfo).tm_mday-time.localtime(time.time()).tm_mdayif tm_year == 0 and tm_mon == 0 and tm_mday >= day_c:print "距离今天",tm_mday,"天发生崩溃"return Trueelse:return False #根据日志里面ExceptionTime时间找日志文件 #param:filename文件名,day_c距离现在多久(单位:天) #return:True 找到在day_c时间内的时间 def found_file(filename,day_c=-2):file_txt = open(filename, "r")lines = file_txt.readlines()file_txt.close()for i in lines:try:date = datetime.datetime.strptime(i[14:24], '%Y-%m-%d')now_time = datetime.datetime.now()after_time = now_time + datetime.timedelta(days=day_c)print "出异常的时间===",dateprint "前时间===",after_times_time = after_time-dateprint "s_time===", s_timeif after_time < date:print "距离今天大概", day_c, "天左右发生崩溃"return Trueexcept ValueError:pass
详细解决方案
根据系统时间或者日志里面EXCEPTION时间找到符合标准的文件
热度:113 发布时间:2023-09-30 21:40:38.0
相关解决方案
- GWT 报错,能的请进: com.google.gwt.event.shared.UmbrellaException: Exception caught: Se
- null id in com.bsw.gms.hibernate.pojo.Score entry (don't flush the Session after an exception occurs,该怎么解决
- 急问:S60,eclipse,打开模拟器总是提示“unhandled exception.Close application?该如何解决
- 捕获异常(尽量别直接捕获System.Exception)
- 为什么基于对话框的程序出现了first-Chance exception in NTDLL.dll解决思路
- 水晶报表-Exception of type 'System.OutOfMemoryException' was thrown.解决思路
- 水晶表格-Exception of type 'System.OutOfMemoryException' was thrown
- 水晶表格-Exception of type 'System.OutOfMemoryException' was thrown
- throw new Exception("不得为空");如何换行
- Exception Details: System.IO.FileLoadException: Could not load file or assembly 'FreeTextBox' or one of its dependencies. 磁盘空间不足,该如何解决
- asp.net给出异常的ORACLE exception
- throw new Exception("Message.")什么意思?该如何处理
- 查询的结果集里包含有特殊字符会造成timeout exception?解决思路
- 如何获取最后一个 Exception
- 異常處理,catch(Exception ex)中的ex.Message怎樣在alert中調用到?解决思路
- sql体现超长(This SQL offer threw the timeout exception)
- exception specification list mismatch解决思路
- 关于First-chance exception in BREW_Simulator.exe (BREWAPP.DLL): 0xC0000005: Access Violation.的有关问题
- 关于MTK的错误(exception)分析
- Processor ARM79_0 raised an exception.Cause: Undefined instruction,该如何处理
- Servlet.service() for servlet jsp threw exception java.lang.NullPointerException,该如何解决
- Servlet failed with Exception,java.lang.NullPointerException。求好手帮忙急
- Hibernate的错误net.sf.hibernate.PropertyAccessException: exception settin
- one hibernate SQL exception ?该如何处理
- Orge编译通过,弹出异常ORGE EXCEPTION(6.)
- [求助]unreporter exception java.text.ParseException;must be caught or ...
- DONE新学JSP,在书上抄的第一个程序,type Exception!
- exception in thread "main" java.lang.NoSuchMethodError:main
- [求助]org/hibernate/exception/DataException
- PHPExcel的exception 'Exception' with message 'The filename is not recognised as an OLE file有关问题解决