I'm using Zend-Framework2 and I'd like to log information about a request. Not all servers provide $_SERVER['UNIQUE_ID'], so I'd like to generate my own(Please see http://en.wikipedia.org/wiki/Universally_unique_identifier for the format).
In ZF2 everything is done within the modules, but I'd like to create an application-wide variable or constant with the unique ID in it. I can add it to index.php, but that's not the way to go I think... Another option is that the generation of the unique request id is being done in the onBootstrap method of the module that is called, but then I'm repeating myself and that is not desirable, I think.
Where should I ideally put the piece of code to generate the UUID and add it as an application-wide variable / constant?
Thanks in advance!
Similar question: Log each request in ZF2