Unexpected multiple controller invocations


my client asked my to produce a log of visited pages/commited actions. So, using the logging features, I've added in my controller base, in the "beforeExecuteRoute()", the recording of called controller/action, then do a logger->commit() in the "afterExecuteRoute()" (to delay the file write op, but I'm not sure that improve page load time, that's not here the problem). All this folks works, but moreover the expected controller/action to be logged, there is four time a record of a "index/index" controller/action recorded... For now, I've added a simple filtering not to record this unwanted lines, but I'm asking now if there is somewhere something bad in my routing/controller invocation...

I'm using volt templates and layouts, could this be related?

edited May '16

You would need to provide more info / configuration example from your app.

From what you provided, I would guess that your AJAX calls etc are being triggered also or anything hitting your index / ControllerBase, i.e. invoking child controllers which trigger parent onConstruct() method. OR it could also be that you have internal dispatch actions, which can also trigger parent constructor each time.

yes, in my controllerBase.php, I use onConstruct() where I get some global param in my db & initialize() where I set templateAfter('main'). In my controller action I then set the dedicated template...

I pushed two pastebin to illustrate my setup:

controllerBase : http://pastebin.com/0ubZ6yVj

clientsController :http://pastebin.com/f05W1sCx