Start and end log message


I’m implementing custom FileLogger, which is originally extended from \yii\log\FileTarget.

I would like to make some sort of profileing for start of all logs and end of them.

I understood that I can simply use init() method to set starting profile, but what method can I use to determine end of the logs?

I tried to override export(), end profile and calling the parent export() method, but I have not success with it.

Did anybody come to this issue before?

Any existing solution?

Not sure what do you want to do , whats wrong with

Anyway any class will execute the __destruct() before dismissing, maybe this will fit your need

   function __destruct() {

   	// all my end profiling stuff


This (__destruct()) is not being called at the end of the logs, just tried this now.

Very strange the __destruct() is always called even if the execution terminate with an exit.

Destructor is not called only when the execution stop due to an error.