当前位置:首页>python>Python工业日志系统设计与实现

Python工业日志系统设计与实现

  • 2026-07-01 05:52:41
Python工业日志系统设计与实现

在真实的工厂车间里,一台设备的异常报警可能意味着数十万的损失。而那条关键的错误日志,往往就是唯一的"案发现场还原"线索。


🏭 那些年,我们被日志坑过的经历

说真的,工控软件的日志问题,是我职业生涯里踩得最深的坑之一。

刚入行那会儿,我负责维护一套PLC通信程序。某天凌晨两点,产线突然停了。翻遍整个系统,日志文件里只有寥寥几行print("error")——连时间戳都没有。那一夜,我和同事对着设备发呆了三个小时,愣是没定位到根因。

这种痛,相信很多做工控、MES、SCADA系统的朋友都懂。

工业场景的日志需求,和普通Web应用完全不是一个量级:多线程并发写入、跨设备数据聚合、毫秒级时序追踪、海量数据的长期归档……随便拎出一条,都够折腾一阵子。

本文就从实战出发,带你搭一套真正能在工业环境里"扛造"的Python日志系统。代码全部可运行,架构可直接迁移到生产项目。


🔍 工业日志的特殊性:哪里和普通日志不一样?

先把问题说清楚,再谈方案。

普通应用的日志,核心诉求是记录和排错。但工业系统的日志,承担的职责要复杂得多——

时序精度要求极高。 一条焊接指令和一条质检结果,如果时间戳偏差超过50ms,数据关联就会失效。这不是"差不多"能过去的事。

多源并发是常态。 同一时刻,温控模块、运动控制模块、视觉检测模块可能同时在写日志。锁竞争、写入顺序错乱,是家常便饭。

日志本身就是业务数据。 工厂的质量追溯、工艺优化,全靠历史日志。这意味着日志不能丢、不能乱、还得方便查。

存储压力大。 一条产线一天可能产生几个GB的原始日志。怎么压缩、怎么分片、怎么归档,都得提前设计好。

带着这四个问题,咱们开始搭架子。


🏗️ 系统架构设计:分层才是王道

太多项目,把所有日志逻辑塞进一个utils.py,然后在几十个模块里importimport去。这玩意儿,短期看没问题,长期必然是一团乱麻。

工业日志系统,我建议采用三层架构

业务层不关心日志怎么存、存哪里。门面层负责统一收口、注入设备ID/工单号等上下文。处理器层各司其职,互不干扰。


🚀 核心实现:从基础到进阶

第一步:构建线程安全的日志基础设施

Python标准库的logging模块本身是线程安全的——但很多人不知道,FileHandler在Windows下的多进程写入是有问题的。工控机上跑多进程采集的场景,必须用RotatingFileHandler配合文件锁,或者直接上队列方案。

python1import logging2import logging.handlers3import threading4import queue5from datetime import datetime6from pathlib import Path789class IndustrialLoggerFactory:10"""11    工业日志工厂类12    核心设计:单例 + 异步队列写入,避免IO阻塞业务线程13    """14    _instance = None15    _lock = threading.Lock()1617def __new__(cls):18if cls._instance is None:19with cls._lock:20if cls._instance is None:21                    cls._instance = super().__new__(cls)22                    cls._instance._initialized = False23return cls._instance2425def __init__(self):26if self._initialized:27return2829        self.log_dir = Path("logs")30        self.log_dir.mkdir(exist_ok=True)3132# 异步队列:业务线程只管往队列扔,IO线程负责实际写入33        self._log_queue = queue.Queue(maxsize=10000)34        self._setup_handlers()35        self._start_async_worker()36        self._initialized = True3738def _setup_handlers(self):39"""配置多目标Handler"""40        self.logger = logging.getLogger("industrial_system")41        self.logger.setLevel(logging.DEBUG)4243# 按日期滚动的文件Handler44        file_handler = logging.handlers.TimedRotatingFileHandler(45            filename=self.log_dir / "system.log",46            when="midnight",        # 每天零点切割47            interval=1,48            backupCount=90,         # 保留90天49            encoding="utf-8"50        )5152# 关键告警单独存一份,方便快速检索53        alarm_handler = logging.handlers.RotatingFileHandler(54            filename=self.log_dir / "alarm.log",55            maxBytes=50 * 1024 * 1024,  # 50MB切割56            backupCount=20,57            encoding="utf-8"58        )59        alarm_handler.setLevel(logging.WARNING)6061        formatter = IndustrialFormatter()62        file_handler.setFormatter(formatter)63        alarm_handler.setFormatter(formatter)6465        self.logger.addHandler(file_handler)66        self.logger.addHandler(alarm_handler)6768def _start_async_worker(self):69"""启动后台IO线程,消费日志队列"""70        worker = threading.Thread(71            target=self._async_write_worker,72            daemon=True,    # 随主进程退出,不阻塞关闭73            name="LogIOWorker"74        )75        worker.start()7677def _async_write_worker(self):78while True:79try:80                record = self._log_queue.get(timeout=1)81if record is None:  # 优雅停止信号82break83                self.logger.handle(record)84except queue.Empty:85continue

这里有个细节值得注意:daemon=True让IO线程随主进程退出,但这意味着程序崩溃时队列里可能还有未写入的日志。生产环境里,建议在主程序的finally块里发送停止信号,等队列清空再退出。


第二步:自定义Formatter,注入工业上下文

标准的日志格式对工业系统来说信息量严重不足。我们需要在每条日志里自动带上设备编号、工单号、操作员ID这些关键字段。

python1import json2import traceback345class IndustrialFormatter(logging.Formatter):6"""7    结构化日志格式器8    输出JSON格式,方便后续用ELK或自研平台解析9    """1011# 线程本地存储:每个线程独立维护自己的上下文12    _context = threading.local()1314@classmethod15def set_context(cls, **kwargs):16"""在业务代码入口处设置上下文,后续日志自动携带"""17for key, value in kwargs.items():18setattr(cls._context, key, value)1920@classmethod21def clear_context(cls):22        cls._context.__dict__.clear()2324def format(self, record: logging.LogRecord) -> str:25# 基础字段26        log_entry = {27"timestamp": datetime.fromtimestamp(record.created).strftime(28"%Y-%m-%d %H:%M:%S.%f"29            )[:-3],  # 精确到毫秒30"level": record.levelname,31"module": record.module,32"func": record.funcName,33"line": record.lineno,34"message": record.getMessage(),35# 从线程本地存储中读取业务上下文36"device_id"getattr(self._context, "device_id""UNKNOWN"),37"work_order"getattr(self._context, "work_order"None),38"operator"getattr(self._context, "operator"None),39        }4041# 异常信息单独格式化,保留完整堆栈42if record.exc_info:43            log_entry["exception"] = {44"type": record.exc_info[0].__name__,45"message"str(record.exc_info[1]),46"traceback": traceback.format_exception(*record.exc_info)47            }4849# 过滤None值,减少存储冗余50        log_entry = {k: v for k, v in log_entry.items() if v is not None}5152return json.dumps(log_entry, ensure_ascii=False)

线程本地存储(threading.local())是这里的关键。 每个采集线程处理不同设备,上下文互不污染。在线程入口处调一次set_context(device_id="PLC_001"),后续这个线程产生的所有日志都会自动带上设备ID。


第三步:设备日志门面——业务代码的唯一入口

有了底层基础设施,再封装一个面向业务的门面类。让业务代码写日志时,不需要关心任何底层细节。

python1from contextlib import contextmanager2from functools import wraps3import time456class DeviceLogger:7"""8    设备日志门面9    业务模块统一通过这个类记录日志10    """1112def __init__(self, device_id: str, device_type: str = "GENERIC"):13        self.device_id = device_id14        self.device_type = device_type15        self._factory = IndustrialLoggerFactory()1617# 初始化时就把设备信息注入上下文18IndustrialFormatter.set_context(19            device_id=device_id,20            device_type=device_type21        )2223def info(self, message: str, **extra):24        self._log(logging.INFO, message, **extra)2526def warning(self, message: str, **extra):27        self._log(logging.WARNING, message, **extra)2829def error(self, message: str, exc_info=False, **extra):30        self._log(logging.ERROR, message, exc_info=exc_info, **extra)3132def critical(self, message: str, **extra):33        self._log(logging.CRITICAL, message, **extra)3435def _log(self, level: int, message: str, exc_info=False, **extra):36        record = logging.LogRecord(37            name="industrial_system",38            level=level,39            pathname="",40            lineno=0,41            msg=message,42            args=(),43            exc_info=logging.sys.exc_info() if exc_info else None44        )45# 把extra字段挂到record上,Formatter可以读取46for key, value in extra.items():47setattr(record, key, value)4849# 非阻塞放入队列50try:51            self._factory._log_queue.put_nowait(record)52except queue.Full:53# 队列满了,这条日志只能丢弃——但这本身也是个告警信号54print(f"[WARN] Log queue full, dropping: {message}")5556@contextmanager57def operation_trace(self, operation_name: str):58"""59        上下文管理器:自动记录操作耗时60        用法:with logger.operation_trace("焊接动作"):61        """62        start = time.perf_counter()63        self.info(f"[START] {operation_name}")64try:65yield66            elapsed = (time.perf_counter() - start) * 100067            self.info(f"[END] {operation_name} | 耗时: {elapsed:.2f}ms")68except Exception as e:69            elapsed = (time.perf_counter() - start) * 100070            self.error(71f"[FAILED] {operation_name} | 耗时: {elapsed:.2f}ms | 原因: {e}",72                exc_info=True73            )74raise  # 异常继续向上传播,不在日志层吞掉757677def log_device_action(operation: str):78"""79    装饰器版本:给函数自动加上日志追踪80    适合那些每次调用都需要记录的设备操作函数81    """82def decorator(func):83@wraps(func)84def wrapper(self, *args, **kwargs):85# 假设self上有logger属性86            logger = getattr(self, 'logger'None)87if logger and hasattr(logger, 'operation_trace'):88with logger.operation_trace(operation):89return func(self, *args, **kwargs)90return func(self, *args, **kwargs)91return wrapper92return decorator

第四步:实战组装——模拟PLC通信场景

把上面这些拼起来,看看实际用起来是什么感觉:

python1class PLCController:2"""PLC控制器示例:展示日志系统在真实业务中的用法"""34def __init__(self, plc_id: str):5        self.plc_id = plc_id6        self.logger = DeviceLogger(7            device_id=plc_id,8            device_type="SIEMENS_S7"9        )10        self.connected = False1112@log_device_action("PLC连接建立")13def connect(self, ip: str, port: int = 102):14"""建立PLC连接"""15        self.logger.info(f"尝试连接 {ip}:{port}")16# 模拟连接逻辑...17        self.connected = True18        self.logger.info("连接成功", ip=ip, port=port)1920def read_registers(self, start_addr: int, count: int) -> list:21"""读取寄存器数据"""22if not self.connected:23            self.logger.error("读取失败:设备未连接")24raise ConnectionError("PLC未连接")2526with self.logger.operation_trace(f"读取寄存器 DB{start_addr}[0..{count}]"):27# 实际项目里这里是snap7或pycomm3的调用28            data = [0] * count29            self.logger.info(30f"寄存器读取完成",31                start_addr=start_addr,32                count=count,33                sample_value=data[0if data else None34            )35return data3637def write_coil(self, addr: int, value: bool):38"""写线圈——这类操作必须有完整的操作记录"""39IndustrialFormatter.set_context(40            device_id=self.plc_id,41            action_type="WRITE",42            target_addr=addr43        )44        self.logger.warning(45f"写入线圈 addr={addr}, value={value}",46            safety_level="MEDIUM"47        )484950# 使用示例51if __name__ == "__main__":52# 设置当前工单上下文53IndustrialFormatter.set_context(54        work_order="WO-20260318-001",55        operator="张工"56    )5758    plc = PLCController("PLC_LINE_A_01")59    plc.connect("192.168.1.100")6061    data = plc.read_registers(start_addr=100, count=10)62    plc.write_coil(addr=200, value=True)

运行后,logs/system.log里的每一行都是结构化JSON,长这样:

json1{2"timestamp""2026-03-18 07:16:49.698",3"level""INFO",4"module""plc_controller",5"func""connect",6"line"28,7"message""连接成功",8"device_id""PLC_LINE_A_01",9"device_type""SIEMENS_S7",10"work_order""WO-20260318-001",11"operator""张工",12"ip""192.168.1.100",13"port"10214}

⚠️ 踩坑预警:这几个地方最容易出问题

坑1:日志队列满了怎么办? 上面代码里用的是put_nowait,队列满直接丢弃。这在大多数场景是合理的——日志不能反过来阻塞业务。但如果你的场景要求日志绝对不丢,可以改成put(block=True, timeout=0.1),超时后写到应急文件。

坑2:Windows下的文件时间戳精度问题。datetime.now()在Windows上的精度只有约15ms,不足以区分高频操作。建议改用time.perf_counter()计算相对时间差,或者引入time.time_ns()

坑3:JSON序列化遇到numpy类型。 工控采集数据里经常有numpy.float32numpy.int64这类类型,直接json.dumps会报错。需要自定义一个JSONEncoder

python1import numpy as np23class IndustrialJSONEncoder(json.JSONEncoder):4def default(self, obj):5if isinstance(obj, np.integer):6return int(obj)7if isinstance(obj, np.floating):8return float(obj)9if isinstance(obj, np.ndarray):10return obj.tolist()11return super().default(obj)1213# 使用时替换json.dumps的encoder参数14json.dumps(log_entry, cls=IndustrialJSONEncoder, ensure_ascii=False)

坑4:多进程场景下的Handler冲突。 如果你的系统是多进程架构(比如用multiprocessing跑多个设备采集进程),每个进程都有自己的FileHandler,同时写同一个文件会导致内容交错。标准解法是用QueueHandler + 独立的日志服务进程,或者每个进程写独

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-07-03 16:51:56 HTTP/2.0 GET : https://f.mffb.com.cn/a/494285.html
  2. 运行时间 : 0.247734s [ 吞吐率:4.04req/s ] 内存消耗:4,738.98kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=980454a8c6a7bc2f49367d9f5b964c57
  1. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/public/index.php ( 0.79 KB )
  2. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/autoload.php ( 0.17 KB )
  3. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_real.php ( 2.49 KB )
  4. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/platform_check.php ( 0.90 KB )
  5. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/ClassLoader.php ( 14.03 KB )
  6. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_static.php ( 4.90 KB )
  7. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper.php ( 8.34 KB )
  8. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/helper.php ( 2.19 KB )
  9. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/helper.php ( 1.47 KB )
  10. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/stubs/load_stubs.php ( 0.16 KB )
  11. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Exception.php ( 1.69 KB )
  12. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Facade.php ( 2.71 KB )
  13. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/deprecation-contracts/function.php ( 0.99 KB )
  14. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap.php ( 8.26 KB )
  15. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap80.php ( 9.78 KB )
  16. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/Resources/functions/dump.php ( 1.49 KB )
  17. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-dumper/src/helper.php ( 0.18 KB )
  18. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/VarDumper.php ( 4.30 KB )
  19. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/App.php ( 15.30 KB )
  20. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Container.php ( 15.76 KB )
  21. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/container/src/ContainerInterface.php ( 1.02 KB )
  22. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/provider.php ( 0.19 KB )
  23. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Http.php ( 6.04 KB )
  24. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Str.php ( 7.29 KB )
  25. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Env.php ( 4.68 KB )
  26. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/common.php ( 0.03 KB )
  27. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/helper.php ( 18.78 KB )
  28. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Config.php ( 5.54 KB )
  29. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/app.php ( 0.95 KB )
  30. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cache.php ( 0.78 KB )
  31. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/console.php ( 0.23 KB )
  32. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cookie.php ( 0.56 KB )
  33. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/database.php ( 2.48 KB )
  34. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Env.php ( 1.67 KB )
  35. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/filesystem.php ( 0.61 KB )
  36. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/lang.php ( 0.91 KB )
  37. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/log.php ( 1.35 KB )
  38. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/middleware.php ( 0.19 KB )
  39. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/route.php ( 1.89 KB )
  40. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/session.php ( 0.57 KB )
  41. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/trace.php ( 0.34 KB )
  42. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/view.php ( 0.82 KB )
  43. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/event.php ( 0.25 KB )
  44. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Event.php ( 7.67 KB )
  45. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/service.php ( 0.13 KB )
  46. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/AppService.php ( 0.26 KB )
  47. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Service.php ( 1.64 KB )
  48. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Lang.php ( 7.35 KB )
  49. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/lang/zh-cn.php ( 13.70 KB )
  50. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/Error.php ( 3.31 KB )
  51. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/RegisterService.php ( 1.33 KB )
  52. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/services.php ( 0.14 KB )
  53. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/PaginatorService.php ( 1.52 KB )
  54. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ValidateService.php ( 0.99 KB )
  55. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ModelService.php ( 2.04 KB )
  56. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Service.php ( 0.77 KB )
  57. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Middleware.php ( 6.72 KB )
  58. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/BootService.php ( 0.77 KB )
  59. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Paginator.php ( 11.86 KB )
  60. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/Validate.php ( 63.20 KB )
  61. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Model.php ( 23.55 KB )
  62. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Attribute.php ( 21.05 KB )
  63. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/AutoWriteData.php ( 4.21 KB )
  64. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Conversion.php ( 6.44 KB )
  65. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/DbConnect.php ( 5.16 KB )
  66. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/ModelEvent.php ( 2.33 KB )
  67. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/RelationShip.php ( 28.29 KB )
  68. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Arrayable.php ( 0.09 KB )
  69. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Jsonable.php ( 0.13 KB )
  70. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/contract/Modelable.php ( 0.09 KB )
  71. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Db.php ( 2.88 KB )
  72. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/DbManager.php ( 8.52 KB )
  73. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Log.php ( 6.28 KB )
  74. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Manager.php ( 3.92 KB )
  75. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerTrait.php ( 2.69 KB )
  76. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerInterface.php ( 2.71 KB )
  77. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cache.php ( 4.92 KB )
  78. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/simple-cache/src/CacheInterface.php ( 4.71 KB )
  79. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Arr.php ( 16.63 KB )
  80. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/driver/File.php ( 7.84 KB )
  81. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/Driver.php ( 9.03 KB )
  82. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php ( 1.99 KB )
  83. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/Request.php ( 0.09 KB )
  84. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Request.php ( 55.78 KB )
  85. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/middleware.php ( 0.25 KB )
  86. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Pipeline.php ( 2.61 KB )
  87. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/TraceDebug.php ( 3.40 KB )
  88. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/middleware/SessionInit.php ( 1.94 KB )
  89. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Session.php ( 1.80 KB )
  90. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/driver/File.php ( 6.27 KB )
  91. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php ( 0.87 KB )
  92. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/Store.php ( 7.12 KB )
  93. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Route.php ( 23.73 KB )
  94. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleName.php ( 5.75 KB )
  95. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Domain.php ( 2.53 KB )
  96. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleGroup.php ( 22.43 KB )
  97. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Rule.php ( 26.95 KB )
  98. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleItem.php ( 9.78 KB )
  99. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/route/app.php ( 1.72 KB )
  100. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Route.php ( 4.70 KB )
  101. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/dispatch/Controller.php ( 4.74 KB )
  102. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Dispatch.php ( 10.44 KB )
  103. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/controller/Index.php ( 4.81 KB )
  104. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/BaseController.php ( 2.05 KB )
  105. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/facade/Db.php ( 0.93 KB )
  106. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/connector/Mysql.php ( 5.44 KB )
  107. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/PDOConnection.php ( 52.47 KB )
  108. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Connection.php ( 8.39 KB )
  109. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/ConnectionInterface.php ( 4.57 KB )
  110. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/builder/Mysql.php ( 16.58 KB )
  111. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Builder.php ( 24.06 KB )
  112. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseBuilder.php ( 27.50 KB )
  113. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Query.php ( 15.71 KB )
  114. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseQuery.php ( 45.13 KB )
  115. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php ( 7.43 KB )
  116. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php ( 3.26 KB )
  117. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php ( 20.07 KB )
  118. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ParamsBind.php ( 3.66 KB )
  119. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ResultOperation.php ( 7.01 KB )
  120. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/WhereQuery.php ( 19.37 KB )
  121. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php ( 7.11 KB )
  122. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php ( 2.63 KB )
  123. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/Transaction.php ( 2.77 KB )
  124. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/driver/File.php ( 5.96 KB )
  125. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php ( 0.86 KB )
  126. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/Channel.php ( 3.89 KB )
  127. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/event/LogRecord.php ( 1.02 KB )
  128. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/Collection.php ( 16.47 KB )
  129. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/View.php ( 1.70 KB )
  130. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/View.php ( 4.39 KB )
  131. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Response.php ( 8.81 KB )
  132. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/response/View.php ( 3.29 KB )
  133. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cookie.php ( 6.06 KB )
  134. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-view/src/Think.php ( 8.38 KB )
  135. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php ( 1.60 KB )
  136. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/Template.php ( 46.61 KB )
  137. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/driver/File.php ( 2.41 KB )
  138. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/contract/DriverInterface.php ( 0.86 KB )
  139. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/runtime/temp/067d451b9a0c665040f3f1bdd3293d68.php ( 11.98 KB )
  140. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Html.php ( 4.42 KB )
  1. CONNECT:[ UseTime:0.000982s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000824s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000879s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000292s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000678s ]
  6. SELECT * FROM `set` [ RunTime:0.000248s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000756s ]
  8. SELECT * FROM `article` WHERE `id` = 494285 LIMIT 1 [ RunTime:0.001937s ]
  9. UPDATE `article` SET `lasttime` = 1783068716 WHERE `id` = 494285 [ RunTime:0.019588s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000424s ]
  11. SELECT * FROM `article` WHERE `id` < 494285 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.001139s ]
  12. SELECT * FROM `article` WHERE `id` > 494285 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.000533s ]
  13. SELECT * FROM `article` WHERE `id` < 494285 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.001221s ]
  14. SELECT * FROM `article` WHERE `id` < 494285 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.014887s ]
  15. SELECT * FROM `article` WHERE `id` < 494285 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.029494s ]
0.251877s