03 Silex Monolog

use Silex\Provider\MonologServiceProvider;
$app->register(new Silex\Provider\MonologServiceProvider(), array(
  'monolog.name' => 'AAAA',
  'monolog.logfile' => __DIR__.'/log/my_app.log',
  'monolog.maxfiles' => 7,
  'monolog.level' => constant("Monolog\Logger::DEBUG"),
));

// ログ書き込み
$app['monolog']->addDebug('debug log');
$app['monolog']->addInfo('info log');
$app['monolog']->addWarning('warning log');
$app['monolog']->addError('error log');

出力されるログ

[2019-02-07 11:47:15] AAAA.DEBUG: debug log [] []
[2019-02-07 11:47:15] AAAA.INFO: info log [] []
[2019-02-07 11:47:15] AAAA.WARNING: warning log [] []
[2019-02-07 11:47:15] AAAA.ERROR: error log [] []