0

play (2.3.8) 反応性 Scala サンプル コードを使用して mongo インスタンスに接続し、作成/読み取りを行いましたが、最初にホスト名を誤って構成したため、LastError を振ることができませんでした。デバッグを有効にする: logger.reactivemongo=DEBUG は詳細を表示します:

[debug] r.c.a.MongoDBSystem - received a checked write request                          
[debug] r.api.Failover - Got an error, retrying... (try #1 is scheduled in 500 ms)      
reactivemongo.core.actors.Exceptions$PrimaryUnavailableException$: MongoError['No primary node is available!']
        at reactivemongo.core.actors.Exceptions$PrimaryUnavailableException$.<clinit>(actors.scala) ~[reactivemongo_2.11-0.10.5.0.akka23.jar:0.10.5.0.akka23]
        at reactivemongo.core.actors.MongoDBSystem$$anonfun$pickChannel$4.apply(actors.scala:508) ~[reactivemongo_2.11-0.10.5.0.akka23.jar:0.10.5.0.akka23]  
        at reactivemongo.core.actors.MongoDBSystem$$anonfun$pickChannel$4.apply(actors.scala:508) ~[reactivemongo_2.11-0.10.5.0.akka23.jar:0.10.5.0.akka23]  
        at scala.Option.getOrElse(Option.scala:120) ~[scala-library-2.11.4.jar:na]                                                                           
        at reactivemongo.core.actors.MongoDBSystem.pickChannel(actors.scala:508) ~[reactivemongo_2.11-0.10.5.0.akka23.jar:0.10.5.0.akka23]                   
[debug] r.c.a.MongoDBSystem - ConnectAll Job running... Status: Node[wengen:27017: Unknown (1/10 available connections), latency=0], auth=Set()              
[debug] r.c.a.MongoDBSystem - ConnectAll Job running... Status: Node[wengen:27017: Unknown (1/10 available connections), latency=0], auth=Set()              
[debug] r.c.a.MongoDBSystem - ConnectAll Job running... Status: Node[wengen:27017: Unknown (1/10 available connections), latency=0], auth=Set()              
[debug] r.c.a.MongoDBSystem - ConnectAll Job running... Status: Node[wengen:27017: Unknown (1/10 available connections), latency=0], auth=Set()              
[info] r.c.a.MongoDBSystem - The node set is now available                                                                                                   
[info] r.c.a.MongoDBSystem - The primary is now available                                                                                                    
[debug] r.c.a.MonitorActor - set: a primary is available                                                                   

and the insert of the POST is fine but for this lastError:

[debug] r.c.a.MongoDBSystem - Sending request expecting response Request(3001,0,Insert(0,playdb.newpersons),BufferSequence(DynamicChannelBuffer(ridx=0, widx=60, cap=64),WrappedArray()),reactivemongo.api.ReadPreference$Primary$@47979aa3,None) by connection Connection([id: 0xedfcbc47, /192.168.15.46:55680 => wengen/192.168.15.67:27017],Connected,Set(),None) of node wengen:27017                                                                                                                                                                                    
[debug] r.c.a.MongoDBSystem - Got a response from -302203833! Will give back message=Response(MessageHeader(110,45,3001,1),Reply(8,0,0,1),LittleEndianHeapChannelBuffer(ridx=36, widx=110, cap=110),ResponseInfo(-302203833)) to promise scala.concurrent.impl.Promise$DefaultPromise@bd0cdcc                                                                                       
[debug] r.c.a.MongoDBSystem - {3001} it's a getlasterror                                                                                                                                  
[debug] application - Successfully inserted with LastError: reactivemongo.core.commands.LastError: DatabaseException['empty lastError message']     

db.resetError()in mongo はこれを取り除きません。コレクションから挿入物を確認。コードはこちら: https://github.com/nanothermite/playrctmongo

助言がありますか?

4

2 に答える 2

2

以下でオーバーライドlogbackします。

<logger name="reactivemongo.api.Failover2">
    <level value="INFO"/>
</logger>

<logger name="reactivemongo.core.actors">
    <level value="INFO"/>
</logger>

これにより、不正な DEBUG メッセージのみが沈黙します。reactivemongo

于 2016-03-14T22:29:30.487 に答える