Log Errors from twig template I need to log flash messages from craft.session.getFlashes to a error log file from a particular twig template in Craft 2. Is there a way to do it ?
Create a plugin (https://docs.craftcms.com/v2/plugins/introduction.html,  https://pluginfactory.io/)
Create a Variable class with a log function (https://docs.craftcms.com/v2/plugins/variables.html)
Pass data from getFlashes to your function from within the template like e.g. craft.yourPluginName.yourVariableFunctionName(craft.session.getFlashes)


Tip: Use YourPluginName::log('blabla' . $string); to log anything to /storage/runtime/logs/yourpluginname.log from within your Plugin