Hi.
I want to log who logged out using Yii::log()
I set ‘prefixUser’=>true in my conf file. So, user names are automatically recorded in the log file.
At first, I did like this.
Yii::log('user logout', 'info', 'system.controllers.site');
Yii::app()->user->logout(true);
But, processLogs is called after removing the session data. So, in this case, the log file is like this.
[info] [system.controllers.site] [Guest][] citizen user logout
There is no name in the log file. But I want to record who logged out. so I called
Yii::app()->log->processLogs(new CEvent($this));
befor logout() called.
It worked well, but I have 2 log lines because processLogs called twice, in my code and onEndRequest event.
[info] [system.controllers.site] [username][1] citizen user logout
[info] [system.controllers.site] [Guest][] citizen user logout
Can I flush log data or is there any solution for my case?