Seldaek / monolog

Sends your logs to files, sockets, inboxes, databases and various web services

Home Page:https://seldaek.github.io/monolog/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fatal error Attempted to load class "MongoClient" from the global namespace

cimo23 opened this issue · comments

bug occur when we use the configuration without ODM Id Service
#1423

monolog:
    handlers:
        main:
            type: mongo
            mongo:
               host: '127.0.0.1'
               port: 27017
               user: root
               pass: '123456'
               database: logsDb
               collection: logsCollection

This seems to be a bug in MonologBundle, or a misuse of it. In any case not something I can fix here. See https://github.com/symfony/monolog-bundle/blob/master/DependencyInjection/MonologExtension.php#L282 it uses MongoClient if you don't define a service id. IMO you should pass a service id (it doesn't have to be ODM, just could be a service defining a MongoDB\Client instance.