Home  >  Article  >  Backend Development  >  yii2 自定义程序访问日志

yii2 自定义程序访问日志

WBOY
WBOYOriginal
2016-07-06 13:51:431298browse

问题

项目使用yii2开发,需要记录所有访问的access_log 自定义格式,现在遇到如下问题

  1. 不知在哪里写日志合适?

  2. 不知道如何动态获取访问的controller action

回复内容:

问题

项目使用yii2开发,需要记录所有访问的access_log 自定义格式,现在遇到如下问题

  1. 不知在哪里写日志合适?

  2. 不知道如何动态获取访问的controller action

  1. 不是很复杂的话,可以直接使用nginx的access_log

  2. 你可以打印下 Yii::$app 来看,都会当前请求所用到的 `controlleraction

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn