2016-01-06 75 views
3

登錄如果我在Silex的定義獨白記錄:定義的Silex

use Monolog\Logger; 
use Monolog\Handler\StreamHandler; 
use Monolog\Handler\FirePHPHandler; 

$app = new Silex\Application(); 

$app->register(new Silex\Provider\MonologServiceProvider(), array(
    'monolog.name' => 'logger', 
    'monolog.logfile' => $logdir . '/f2alma.log', 
    'monolog.level' => \Monolog\Logger::DEBUG 
)); 

$app['monolog']->addDebug('Testing the Monolog logging.'); 
... 
$app->run(); 

我得到的錯誤PHP消息:

[Wed Jan 06 10:07:34.994088 2016] [:error] [pid 4594] [client 130.133.152.188:47369] PHP Catchable fatal error: Argument 4 passed to Symfony\Component\HttpKernel\EventListener\RouterListener::__construct() must be an instance of Psr\Log\LoggerInterface, instance of Monolog\Logger given, called in /usr/local/silex/vendor/silex/silex/src/Silex/Application.php on line 102 and defined in /usr/local/silex/vendor/symfony/http-kernel/EventListener/RouterListener.php on line 52

這裏有什麼錯?

感謝,

克里斯托夫

+0

如果Monolog \ Logger實現Psr \ Log \ LoggerInterface,請查看代碼。可能是monolog更新會有所幫助.. –

+0

你可以發佈你的monolog和silex版本嗎? – mTorres

+0

獨白:1.0.2(2011-10-24) Silex:1.3 – Christoph

回答

3

我有同樣的問題,我固定它改變了我的獨白版本。 最新版本可以在Packagist進行檢查。