[JAVA-615] Turn off warning when using command method Created: 02/Aug/12  Updated: 11/Sep/19  Resolved: 03/Aug/12

Status: Closed
Project: Java Driver
Component/s: Cluster Management
Affects Version/s: 2.0
Fix Version/s: None

Type: Task Priority: Minor - P4
Reporter: Sam Irmes Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

When I run the java driver method command like in the scala code below:

private var db: DB = null

...[more set up code here]..

db = mongoConnection.getDB(saksApiDBName)
db.cleanCursors(false)

and run the command

db.command("isMaster");

I get the expected result, what is

{ "setName" : "DEVrs" , "ismaster" : true , "secondary" : false , "hosts" : [ "SD2DVD07VL.SAKSDIRECT.COM:27017" , "SD2DVD08VL.SAKSDIRECT.COM:27017" , "SD2DVD03VL:27017"] , "primary" : "SD2DVD07VL.SAKSDIRECT.COM:27017" , "me" : "SD2DVD07VL.SAKSDIRECT.COM:27017" , "maxBsonObjectSize" : 16777216 , "ok" : 1.0}

but also get warnings in the console:

Aug 2, 2012 11:50:09 AM com.mongodb.ReplicaSetStatus$Node update
WARNING: Server seen up: SD2DVD07VL.SAKSDIRECT.COM:27017
Aug 2, 2012 11:50:09 AM com.mongodb.ReplicaSetStatus findNode
WARNING: couldn't resolve host [SD2DVD03VL:27017]
Aug 2, 2012 11:50:09 AM com.mongodb.ReplicaSetStatus _addIfNotHere
WARNING: couldn't resolve host [SD2DVD03VL:27017]
Aug 2, 2012 11:50:09 AM com.mongodb.ReplicaSetStatus$Node update
WARNING: Server seen up: SD2DVD08VL.SAKSDIRECT.COM:27017
Aug 2, 2012 11:50:09 AM com.mongodb.ReplicaSetStatus findNode
WARNING: couldn't resolve host [SD2DVD03VL:27017]
Aug 2, 2012 11:50:09 AM com.mongodb.ReplicaSetStatus _addIfNotHere
WARNING: couldn't resolve host [SD2DVD03VL:27017]
Aug 2, 2012 11:50:09 AM com.mongodb.ReplicaSetStatus$Node update
WARNING: Server seen up: SD2DVD03VL.SAKSDIRECT.COM:27017
Aug 2, 2012 11:50:09 AM com.mongodb.ReplicaSetStatus findNode
WARNING: couldn't resolve host [SD2DVD03VL:27017]
Aug 2, 2012 11:50:09 AM com.mongodb.ReplicaSetStatus _addIfNotHere
WARNING: couldn't resolve host [SD2DVD03VL:27017]
Aug 2, 2012 11:50:09 AM com.mongodb.ReplicaSetStatus findNode
WARNING: couldn't resolve host [SD2DVD03VL:27017]
Aug 2, 2012 11:50:09 AM com.mongodb.ReplicaSetStatus _addIfNotHere
WARNING: couldn't resolve host [SD2DVD03VL:27017]
Aug 2, 2012 11:50:09 AM com.mongodb.ReplicaSetStatus findNode
WARNING: couldn't resolve host [SD2DVD03VL:27017]
Aug 2, 2012 11:50:09 AM com.mongodb.ReplicaSetStatus _addIfNotHere
WARNING: couldn't resolve host [SD2DVD03VL:27017]
Aug 2, 2012 11:50:09 AM com.mongodb.ReplicaSetStatus findNode
WARNING: couldn't resolve host [SD2DVD03VL:27017]
Aug 2, 2012 11:50:09 AM com.mongodb.ReplicaSetStatus _addIfNotHere
WARNING: couldn't resolve host [SD2DVD03VL:27017]

Any of the options below are fine with me:
1) Is there a better way to get the hosts used in a replica set?
2) Can I turn off temporarily the logs exposed by the driver for that particular operation?
3) How to change log level?

Thanks



 Comments   
Comment by Jeffrey Yemin [ 03/Aug/12 ]

Glad to be of help.

Comment by Sam Irmes [ 03/Aug/12 ]

Got it! I am going to upgrade to 2.8.0 and change my log level (should be that).
Thank you very much and please feel free to close the ticket

Comment by Jeffrey Yemin [ 03/Aug/12 ]

You set affect version 2.0, so I thought that's what you were using. The current version of the driver is 2.8.0, which has many new features, bug fixes, and some performance improvements.

Regarding the log level, it depends on what logging framework you're using. Usually this is controlled via an external configuration file, but it can also be done programmatically. If you're using Log4J, check out http://logging.apache.org/log4j/1.2/manual.html.

Comment by Sam Irmes [ 03/Aug/12 ]

Thanks, I will try the option 3 like you said. Can you tell me how to do that in my java class?
I could not find much information on my search.

Also, we are using java driver 2.6.3. Did you see anything we could improve?

Comment by Jeffrey Yemin [ 03/Aug/12 ]
  1. ismaster is a good way to get the hosts
  2. no
  3. you could bump up the log level on com.mongodb.ReplicaSetStatus to ERROR.

Just curious also why you're using such an old driver version? There have been a lot of improvements since 2.0.

Generated at Thu Feb 08 08:52:41 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.