How not to show last bracket in a monolog log line?
问题 // in my PHP code $log = new Logger('LaurentCommand'); $log->pushHandler(new StreamHandler('./app/logs/LaurentCommand.log')); $log->addInfo("Start command",array('username' => 'Joe', 'Age' => '28')); Result in log file LaurentCommand.log : [2012-12-20 10:28:11] LaurentCommand.INFO: Start command {"username":"Joe","Age":"28"} [] Why this bracket at the end ? 回答1: That's the extra data. The default format of the LineFormatter is "[%datetime%] %channel%.%level_name%: %message% %context% %extra%