【问题标题】:Audit log with Symfony, best practicesSymfony 审计日志,最佳实践
【发布时间】:2011-03-04 03:05:38
【问题描述】:

我正在实施的系统的性质目前需要严格记录用户执行的所有访问/操作。

我知道我可以使用 symfony 记录器来记录不同的操作,但是有没有一种干净的方法可以做到这一点?我宁愿避免根据正在访问的功能,每次都有不同消息的多个日志调用,无论如何我可以覆盖一个类,以便我的日志调用只进行一次。我需要存储尽可能多的信息,以便我可以重新跟踪任何用户在任何给定时间执行的所有步骤。

我要找一个可能有帮助的插件。

感谢您提供任何信息!

【问题讨论】:

    标签: php symfony-1.4


    【解决方案1】:

    您可以使用 sfFilter 来避免扩展所有记录模块和路由操作的操作。你可以看到this post 我做了类似的东西但是可以指导你。

    您还可以查看this,它解释了如何使用 sfFilters

    【讨论】:

      【解决方案2】:

      我正在考虑扩展 sfActions。

      code mySfActions extends sfActions
      {
        public function preExecute()
        {
          //log this->getActionName(), $this->getModuleName(), __FILE__ etc
          //capture user information ($this->getUser() should work)
      
          // then call this function to ensure all current preExecute methods work correctly
          parent::preExecute()
        }
      }
      

      然后我所有的actions.class.php文件将扩展这个类而不是sfActions。

      这样它应该给我足够的信息,但我只在代码中得到过一次。

      想法?

      【讨论】:

      • 事实上,the parent::preExecute() call 需要在所有当前 preExecute 函数的末尾
      猜你喜欢
      • 2016-02-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-02
      • 1970-01-01
      • 2010-11-07
      • 2018-03-27
      • 1970-01-01
      相关资源
      最近更新 更多