Open sreecodeslayer opened 7 years ago
@oz123 any idea ? I don't see any reason why this should not work.
Hey, I got it to work
When I checked the Pymongo doc, it says we can pass uri
in to host
.
The host parameter can be a full mongodb URI, in addition to a simple hostname. It can also be a list of hostnames or URIs.
So instead of giving username, password separately, i gave it like this,
handler = MongoHandler(host='mongodb://username:password@localhost:27045')
and everything remains same, and I can confirm I have log data in the collection, so i guess it is better to mention this in the README for others who is using Auth :slightly_smiling_face: :+1:
Will do. Thanks.
I will close this issue after README is updated.
Still pending..
It happended to me and I guess I found the reason.
It happens in MongoHandler._connect
meth. For a database need auth, connect.is_locked should be call after auth.But, it adverses.
It will be normal at no-auth situation, but not at auth need.
Issue :
What am trying to do with log4mongo :
I am writing a scrapy spider in which I need the log to be sent to MongoDB. My other mongo connections using
MongoClient
auth uri works fine. (ie.:client=MongoClient('mongodb://username:password@localhost:27045')
) with auth db asadmin
that has roles granted accordingly.I followed the README, but I can't get the Auth part to work, when the MongoDB is with auth disabled, the connection works.
Versions used: