How to change date format in "zend_log"

How to change the date format of Zend_Log?

Now, before each new journal entry, a date with a time stamp is added:
"2013-01-28T16: 47: 54 + 01: 00 ... some kind of journal message ..."

But I would like to format this date as:
"Ymd H: i: s ... some kind of log message ..."

My code is as follows:

class Game_Logger { public function __construct($val, $txt = null) { $writer = new Zend_Log_Writer_Stream(APPLICATION_PATH . '/../log/log.log'); $logger = new Zend_Log($writer); if (is_array($val)) { $output = Zend_Debug::dump($val, null, false); } else { $output = $val; } if($txt){ $output = $txt.' '.$output; } $logger->info($output); } } 
+4
source share
1 answer

This will probably solve your problem:

$logger->setTimestampFormat("H:i:s");
but something tells me that you already understood it;).

+6
source

All Articles