log4mongo / log4mongo-python

python logging handler for mongo database
http://log4mongo.org
Other
111 stars 37 forks source link

how to connect serverless instance in mongodb.net #53

Open nabeenb opened 1 year ago

nabeenb commented 1 year ago

I am trying to connect via BufferedMongoHandler to remote hosted serverless instance in mongodb.net. Do you have any sample or example.

oz123 commented 1 year ago

Unfortunately, no. How are you connecting to it via other tools?

nabeenb commented 1 year ago

Ok, I am able to connect via URI. Now error is log4mongo/handlers.py", line 300, in flush_to_mongo self.handleError(self.last_record) #handling the error on flush

oz123 commented 1 year ago

Please post the complete stack trace.

nabeenb commented 1 year ago

BufferedMongoHandler(host=uri,

username='',

                        #password='',
                        database_name='mydb',
                        collection='logs',
                        authentication_db='mydb',
                        capped=True,
                        buffer_size=1000,                           # buffer size.
                        buffer_periodical_flush_timing=60.0,       # periodical flush every 60 seconds
                        buffer_early_flush_level=logging.CRITICAL)

able to login. is there way to use two different collections for two set of logs.

oz123 commented 1 year ago

You can define to handlers. Each one should write to a collection.