Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to not truncate Mongoid logs?

This is how the Mongoid log the operations:

D, [2016-01-12T18:42:19.790639 #7906] DEBUG -- : MONGODB | localhost:27017 | app_test.update | STARTED | {"update"=>"users", "updates"=>[{"q"=>{"_id"=>BSON::ObjectId('5695652bc54d2d1ee200001e')}, "u"=>{"$addToSet"=>{"favorite_ids"=>{"$each"=>[BSON::ObjectId('5695652bc54d2d1ee200001f')]}}}, "multi"=>false, "upsert"=>false}], "writeConcern"=>{:w=>1}, "orde...

I want to be able to see the full log message. Is that possible?

Obs: I'm using Mongoid 5.

like image 747
Rodrigo Avatar asked Jan 12 '16 20:01

Rodrigo


1 Answers

After digging into Mongo Ruby Driver (which is used by Mongoid >= 5), I've found a solution:

Mongo::Monitoring::CommandLogSubscriber::LOG_STRING_LIMIT = 1_000

Edit

The proper way to do this is add truncate_logs option to mongoid.yml file:

config/mongoid.yml:

development:
  clients:
    default:
      database: database_name_development
      hosts:
        - localhost:27017
      options:
        truncate_logs: false

--

Mongoid has a poor documentation

like image 120
Rodrigo Avatar answered Oct 04 '22 18:10

Rodrigo