summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2014-06-03 14:37:01 -0400
committerBenety Goh <benety@mongodb.com>2014-06-04 21:03:13 -0400
commitfff5d13830e44fbca742ad6c61239f439864ae29 (patch)
tree0605fe66526b7cb31444d9dd2d0997749fd13cd3
parent64e3b85a7c8a4a6ea7c68f25ae27780c702cdfb5 (diff)
downloadmongo-fff5d13830e44fbca742ad6c61239f439864ae29.tar.gz
SERVER-14116 logging cleanup - removed out()
-rw-r--r--src/mongo/client/clientAndShell.cpp6
-rw-r--r--src/mongo/client/dbclientinterface.h2
-rw-r--r--src/mongo/db/cloner.cpp2
-rw-r--r--src/mongo/db/commands.cpp2
-rw-r--r--src/mongo/db/db.cpp2
-rw-r--r--src/mongo/db/dbeval.cpp6
-rw-r--r--src/mongo/db/index/btree_based_access_method.cpp6
-rw-r--r--src/mongo/db/instance.cpp2
-rw-r--r--src/mongo/db/jsobj.cpp2
-rw-r--r--src/mongo/db/mongod_options.cpp8
-rw-r--r--src/mongo/db/repl/master_slave.cpp2
-rw-r--r--src/mongo/db/restapi.cpp2
-rw-r--r--src/mongo/db/structure/btree/btree_logic.cpp24
-rw-r--r--src/mongo/db/structure/btree/key.cpp2
-rw-r--r--src/mongo/db/structure/catalog/hashtab.h10
-rw-r--r--src/mongo/dbtests/jsontests.cpp14
-rw-r--r--src/mongo/dbtests/jstests.cpp10
-rw-r--r--src/mongo/dbtests/repltests.cpp8
-rw-r--r--src/mongo/s/server.cpp4
-rw-r--r--src/mongo/util/log.h5
-rw-r--r--src/mongo/util/mmap_win.cpp2
-rw-r--r--src/mongo/util/net/listen.cpp2
-rw-r--r--src/mongo/util/net/sock.cpp1
23 files changed, 61 insertions, 63 deletions
diff --git a/src/mongo/client/clientAndShell.cpp b/src/mongo/client/clientAndShell.cpp
index 466111b6162..66092e70e2e 100644
--- a/src/mongo/client/clientAndShell.cpp
+++ b/src/mongo/client/clientAndShell.cpp
@@ -53,10 +53,10 @@ namespace mongo {
mongo::mutex::scoped_lock lk( shell_utils::mongoProgramOutputMutex );
dbexitCalled = true;
}
- out() << "dbexit called" << endl;
+ log() << "dbexit called" << endl;
if ( whyMsg )
- out() << " b/c " << whyMsg << endl;
- out() << "exiting" << endl;
+ log() << " b/c " << whyMsg << endl;
+ log() << "exiting" << endl;
::_exit( returnCode );
}
diff --git a/src/mongo/client/dbclientinterface.h b/src/mongo/client/dbclientinterface.h
index e9b00610070..900c8c51772 100644
--- a/src/mongo/client/dbclientinterface.h
+++ b/src/mongo/client/dbclientinterface.h
@@ -876,7 +876,7 @@ namespace mongo {
jscode source code for a javascript function.
info the command object which contains any information on the invocation result including
the return value and other information. If an error occurs running the jscode, error
- information will be in info. (try "out() << info.toString()")
+ information will be in info. (try "log() << info.toString()")
retValue return value from the jscode function.
args args to pass to the jscode function. when invoked, the 'args' variable will be defined
for use by the jscode.
diff --git a/src/mongo/db/cloner.cpp b/src/mongo/db/cloner.cpp
index 865c5eb4709..926b32c3b9e 100644
--- a/src/mongo/db/cloner.cpp
+++ b/src/mongo/db/cloner.cpp
@@ -140,7 +140,7 @@ namespace mongo {
/* assure object is valid. note this will slow us down a little. */
const Status status = validateBSON(tmp.objdata(), tmp.objsize());
if (!status.isOK()) {
- out() << "Cloner: skipping corrupt object from " << from_collection
+ log() << "Cloner: skipping corrupt object from " << from_collection
<< ": " << status.reason();
continue;
}
diff --git a/src/mongo/db/commands.cpp b/src/mongo/db/commands.cpp
index ed487950309..01153cf5323 100644
--- a/src/mongo/db/commands.cpp
+++ b/src/mongo/db/commands.cpp
@@ -271,7 +271,7 @@ namespace mongo {
void Command::logIfSlow( const Timer& timer, const string& msg ) {
int ms = timer.millis();
if (ms > serverGlobalParams.slowMS) {
- out() << msg << " took " << ms << " ms." << endl;
+ log() << msg << " took " << ms << " ms." << endl;
}
}
diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp
index 1bb41663965..476d7bb65ea 100644
--- a/src/mongo/db/db.cpp
+++ b/src/mongo/db/db.cpp
@@ -990,7 +990,7 @@ static int mongoDbMain(int argc, char* argv[], char **envp) {
unsigned x = 0x12345678;
unsigned char& b = (unsigned char&) x;
if ( b != 0x78 ) {
- out() << "big endian cpus not yet supported" << endl;
+ log() << "big endian cpus not yet supported" << endl;
return 33;
}
}
diff --git a/src/mongo/db/dbeval.cpp b/src/mongo/db/dbeval.cpp
index 35a566a3a32..335465709aa 100644
--- a/src/mongo/db/dbeval.cpp
+++ b/src/mongo/db/dbeval.cpp
@@ -90,8 +90,8 @@ namespace mongo {
if ( argsElement.type() == Array ) {
args = argsElement.embeddedObject();
if ( edebug ) {
- out() << "args:" << args.toString() << endl;
- out() << "code:\n" << code << endl;
+ log() << "args:" << args.toString() << endl;
+ log() << "code:\n" << code << endl;
}
}
}
@@ -102,7 +102,7 @@ namespace mongo {
res = s->invoke(f, &args, 0, storageGlobalParams.quota ? 10 * 60 * 1000 : 0);
int m = t.millis();
if (m > serverGlobalParams.slowMS) {
- out() << "dbeval slow, time: " << dec << m << "ms " << dbName << endl;
+ log() << "dbeval slow, time: " << dec << m << "ms " << dbName << endl;
if ( m >= 1000 ) log() << code << endl;
else OCCASIONALLY log() << code << endl;
}
diff --git a/src/mongo/db/index/btree_based_access_method.cpp b/src/mongo/db/index/btree_based_access_method.cpp
index 4b913ee1d7d..612838f88bd 100644
--- a/src/mongo/db/index/btree_based_access_method.cpp
+++ b/src/mongo/db/index/btree_based_access_method.cpp
@@ -148,9 +148,9 @@ namespace mongo {
} catch (AssertionException& e) {
log() << "Assertion failure: _unindex failed "
<< _descriptor->indexNamespace() << endl;
- out() << "Assertion failure: _unindex failed: " << e.what() << '\n';
- out() << " key:" << key.toString() << '\n';
- out() << " dl:" << loc.toString() << endl;
+ log() << "Assertion failure: _unindex failed: " << e.what() << '\n';
+ log() << " key:" << key.toString() << '\n';
+ log() << " dl:" << loc.toString() << endl;
logContext();
}
diff --git a/src/mongo/db/instance.cpp b/src/mongo/db/instance.cpp
index 9c104746f72..55b840bb9f3 100644
--- a/src/mongo/db/instance.cpp
+++ b/src/mongo/db/instance.cpp
@@ -434,7 +434,7 @@ namespace mongo {
char *p = m.singleData()->_data;
int len = strlen(p);
if ( len > 400 )
- out() << curTimeMillis64() % 10000 <<
+ log() << curTimeMillis64() % 10000 <<
" long msg received, len:" << len << endl;
Message *resp = new Message();
diff --git a/src/mongo/db/jsobj.cpp b/src/mongo/db/jsobj.cpp
index 716e9456769..ab0a1805c3f 100644
--- a/src/mongo/db/jsobj.cpp
+++ b/src/mongo/db/jsobj.cpp
@@ -1018,7 +1018,7 @@ namespace mongo {
}
void BSONObj::dump() const {
- LogstreamBuilder builder = out();
+ LogstreamBuilder builder = log();
builder << hex;
const char *p = objdata();
for ( int i = 0; i < objsize(); i++ ) {
diff --git a/src/mongo/db/mongod_options.cpp b/src/mongo/db/mongod_options.cpp
index 2eb713ba92e..16cbd9bca98 100644
--- a/src/mongo/db/mongod_options.cpp
+++ b/src/mongo/db/mongod_options.cpp
@@ -449,15 +449,15 @@ namespace mongo {
namespace {
void sysRuntimeInfo() {
- out() << "sysinfo:" << endl;
+ log() << "sysinfo:" << endl;
#if defined(_SC_PAGE_SIZE)
- out() << " page size: " << (int) sysconf(_SC_PAGE_SIZE) << endl;
+ log() << " page size: " << (int) sysconf(_SC_PAGE_SIZE) << endl;
#endif
#if defined(_SC_PHYS_PAGES)
- out() << " _SC_PHYS_PAGES: " << sysconf(_SC_PHYS_PAGES) << endl;
+ log() << " _SC_PHYS_PAGES: " << sysconf(_SC_PHYS_PAGES) << endl;
#endif
#if defined(_SC_AVPHYS_PAGES)
- out() << " _SC_AVPHYS_PAGES: " << sysconf(_SC_AVPHYS_PAGES) << endl;
+ log() << " _SC_AVPHYS_PAGES: " << sysconf(_SC_AVPHYS_PAGES) << endl;
#endif
}
} // namespace
diff --git a/src/mongo/db/repl/master_slave.cpp b/src/mongo/db/repl/master_slave.cpp
index 820a042c498..2494177a02c 100644
--- a/src/mongo/db/repl/master_slave.cpp
+++ b/src/mongo/db/repl/master_slave.cpp
@@ -1144,7 +1144,7 @@ namespace repl {
}
}
catch (...) {
- out() << "caught exception in _replMain" << endl;
+ log() << "caught exception in _replMain" << endl;
s = 4;
}
diff --git a/src/mongo/db/restapi.cpp b/src/mongo/db/restapi.cpp
index 1653bdd4822..e6a33c4fd11 100644
--- a/src/mongo/db/restapi.cpp
+++ b/src/mongo/db/restapi.cpp
@@ -116,7 +116,7 @@ namespace mongo {
responseCode = 400;
headers.push_back( "X_err: bad request" );
ss << "don't know how to handle a [" << method << "]";
- out() << "don't know how to handle a [" << method << "]" << endl;
+ log() << "don't know how to handle a [" << method << "]" << endl;
}
if( html )
diff --git a/src/mongo/db/structure/btree/btree_logic.cpp b/src/mongo/db/structure/btree/btree_logic.cpp
index 5d54544fc05..0c25dc4f6a1 100644
--- a/src/mongo/db/structure/btree/btree_logic.cpp
+++ b/src/mongo/db/structure/btree/btree_logic.cpp
@@ -1580,10 +1580,10 @@ namespace mongo {
}
}
- out() << "ERROR: can't find ref to child bucket.\n";
- out() << "child: " << bucketLoc << "\n";
+ log() << "ERROR: can't find ref to child bucket.\n";
+ log() << "child: " << bucketLoc << "\n";
//dump();
- out() << "Parent: " << bucket->parent << "\n";
+ log() << "Parent: " << bucket->parent << "\n";
//p->dump();
invariant(false);
return -1; // just to compile
@@ -2133,10 +2133,10 @@ namespace mongo {
FullKey secondKey = getFullKey(bucket, i + 1);
int z = firstKey.data.woCompare(secondKey.data, ordering);
if (z > 0) {
- out() << "ERROR: btree key order corrupt. Keys:" << endl;
+ log() << "ERROR: btree key order corrupt. Keys:" << endl;
if (++nDumped < 5) {
for (int j = 0; j < bucket->n; j++) {
- out() << " " << getFullKey(bucket, j).data.toString() << endl;
+ log() << " " << getFullKey(bucket, j).data.toString() << endl;
}
dumpBucket(bucket);
}
@@ -2145,10 +2145,10 @@ namespace mongo {
}
else if (z == 0) {
if (!(firstKey.header.recordLoc < secondKey.header.recordLoc)) {
- out() << "ERROR: btree key order corrupt (recordlocs wrong):" << endl;
- out() << " k(" << i << ")" << firstKey.data.toString()
+ log() << "ERROR: btree key order corrupt (recordlocs wrong):" << endl;
+ log() << " k(" << i << ")" << firstKey.data.toString()
<< " RL:" << firstKey.header.recordLoc.toString() << endl;
- out() << " k(" << i + 1 << ")" << secondKey.data.toString()
+ log() << " k(" << i + 1 << ")" << secondKey.data.toString()
<< " RL:" << secondKey.header.recordLoc.toString() << endl;
wassert(firstKey.header.recordLoc < secondKey.header.recordLoc);
}
@@ -2258,10 +2258,10 @@ namespace mongo {
BucketType* bucket = getBucket(bucketLoc);
if (*posInOut < 0 || *posInOut >= bucket->n ) {
- out() << "ASSERT failure advancing btree bucket" << endl;
- out() << " thisLoc: " << bucketLoc.toString() << endl;
- out() << " keyOfs: " << *posInOut << " n:" << bucket->n << " direction: " << direction << endl;
- // out() << bucketSummary() << endl;
+ log() << "ASSERT failure advancing btree bucket" << endl;
+ log() << " thisLoc: " << bucketLoc.toString() << endl;
+ log() << " keyOfs: " << *posInOut << " n:" << bucket->n << " direction: " << direction << endl;
+ // log() << bucketSummary() << endl;
invariant(false);
}
diff --git a/src/mongo/db/structure/btree/key.cpp b/src/mongo/db/structure/btree/key.cpp
index 5b1262fb275..7cf1d5e7443 100644
--- a/src/mongo/db/structure/btree/key.cpp
+++ b/src/mongo/db/structure/btree/key.cpp
@@ -140,7 +140,7 @@ namespace mongo {
return 0;
}
default:
- out() << "oldCompareElementValues: bad type " << (int) l.type() << endl;
+ log() << "oldCompareElementValues: bad type " << (int) l.type() << endl;
verify(false);
}
return -1;
diff --git a/src/mongo/db/structure/catalog/hashtab.h b/src/mongo/db/structure/catalog/hashtab.h
index e73962ee31d..72c15e2d7b6 100644
--- a/src/mongo/db/structure/catalog/hashtab.h
+++ b/src/mongo/db/structure/catalog/hashtab.h
@@ -87,7 +87,7 @@ namespace mongo {
if ( nodes(i).hash == h && nodes(i).k == k ) {
if ( chain >= 200 )
- out() << "warning: hashtable " << name << " long chain " << std::endl;
+ log() << "warning: hashtable " << name << " long chain " << std::endl;
found = true;
return i;
}
@@ -95,13 +95,13 @@ namespace mongo {
i = (i+1) % n;
if ( i == start ) {
// shouldn't get here / defensive for infinite loops
- out() << "error: hashtable " << name << " is full n:" << n << std::endl;
+ log() << "error: hashtable " << name << " is full n:" << n << std::endl;
return -1;
}
if( chain >= maxChain ) {
if ( firstNonUsed >= 0 )
return firstNonUsed;
- out() << "error: hashtable " << name << " max chain reached:" << maxChain << std::endl;
+ log() << "error: hashtable " << name << " max chain reached:" << maxChain << std::endl;
return -1;
}
}
@@ -111,7 +111,7 @@ namespace mongo {
/* buf must be all zeroes on initialization. */
HashTable(void* buf, int buflen, const char *_name) : name(_name) {
int m = sizeof(Node);
- // out() << "hashtab init, buflen:" << buflen << " m:" << m << std::endl;
+ // log() << "hashtab init, buflen:" << buflen << " m:" << m << std::endl;
n = buflen / m;
if ( (n & 1) == 0 )
n--;
@@ -120,7 +120,7 @@ namespace mongo {
//nodes = (Node *) buf;
if ( sizeof(Node) != 628 ) {
- out() << "HashTable() " << _name << " sizeof(node):" << sizeof(Node) << " n:" << n << " sizeof(Key): " << sizeof(Key) << " sizeof(Type):" << sizeof(Type) << std::endl;
+ log() << "HashTable() " << _name << " sizeof(node):" << sizeof(Node) << " n:" << n << " sizeof(Key): " << sizeof(Key) << " sizeof(Type):" << sizeof(Type) << std::endl;
verify( sizeof(Node) == 628 );
}
diff --git a/src/mongo/dbtests/jsontests.cpp b/src/mongo/dbtests/jsontests.cpp
index a8e17ca4ba5..c7aa8eedb8a 100644
--- a/src/mongo/dbtests/jsontests.cpp
+++ b/src/mongo/dbtests/jsontests.cpp
@@ -592,12 +592,14 @@ namespace JsonTests {
const char* msg) {
const bool bad = expected.woCompare( actual );
if ( bad ) {
- out() << "want:" << expected.jsonString() << " size: " << expected.objsize() << endl;
- out() << "got :" << actual.jsonString() << " size: " << actual.objsize() << endl;
- out() << expected.hexDump() << endl;
- out() << actual.hexDump() << endl;
- out() << msg << endl;
- out() << "orig json:" << this->json();
+ ::mongo::log() << "want:" << expected.jsonString()
+ << " size: " << expected.objsize() << endl;
+ ::mongo::log() << "got :" << actual.jsonString()
+ << " size: " << actual.objsize() << endl;
+ ::mongo::log() << expected.hexDump() << endl;
+ ::mongo::log() << actual.hexDump() << endl;
+ ::mongo::log() << msg << endl;
+ ::mongo::log() << "orig json:" << this->json();
}
ASSERT( !bad );
}
diff --git a/src/mongo/dbtests/jstests.cpp b/src/mongo/dbtests/jstests.cpp
index f3c82802d4c..63ec2ee2e21 100644
--- a/src/mongo/dbtests/jstests.cpp
+++ b/src/mongo/dbtests/jstests.cpp
@@ -1052,10 +1052,12 @@ namespace JSTests {
// This can be overriden if a different meaning of equality besides woCompare is needed
virtual void bsonEquals( const BSONObj &expected, const BSONObj &actual ) {
if ( expected.woCompare( actual ) ) {
- out() << "want:" << expected.jsonString() << " size: " << expected.objsize() << endl;
- out() << "got :" << actual.jsonString() << " size: " << actual.objsize() << endl;
- out() << expected.hexDump() << endl;
- out() << actual.hexDump() << endl;
+ ::mongo::log() << "want:" << expected.jsonString()
+ << " size: " << expected.objsize() << endl;
+ ::mongo::log() << "got :" << actual.jsonString()
+ << " size: " << actual.objsize() << endl;
+ ::mongo::log() << expected.hexDump() << endl;
+ ::mongo::log() << actual.hexDump() << endl;
}
ASSERT( !expected.woCompare( actual ) );
}
diff --git a/src/mongo/dbtests/repltests.cpp b/src/mongo/dbtests/repltests.cpp
index b9b5687513b..eb1b45065ad 100644
--- a/src/mongo/dbtests/repltests.cpp
+++ b/src/mongo/dbtests/repltests.cpp
@@ -111,8 +111,8 @@ namespace ReplTests {
}
void check( const BSONObj &expected, const BSONObj &got ) const {
if ( expected.woCompare( got ) ) {
- out() << "expected: " << expected.toString()
- << ", got: " << got.toString() << endl;
+ ::mongo::log() << "expected: " << expected.toString()
+ << ", got: " << got.toString() << endl;
}
ASSERT_EQUALS( expected , got );
}
@@ -202,10 +202,10 @@ namespace ReplTests {
RecordIterator* it = coll->getIterator( DiskLoc(), false,
CollectionScanParams::FORWARD );
- out() << "all for " << ns << endl;
+ ::mongo::log() << "all for " << ns << endl;
while ( !it->isEOF() ) {
DiskLoc currLoc = it->getNext();
- out() << coll->docFor(currLoc).toString() << endl;
+ ::mongo::log() << coll->docFor(currLoc).toString() << endl;
}
delete it;
}
diff --git a/src/mongo/s/server.cpp b/src/mongo/s/server.cpp
index 291f627ccba..f8045b7450f 100644
--- a/src/mongo/s/server.cpp
+++ b/src/mongo/s/server.cpp
@@ -330,13 +330,13 @@ static int _main() {
}
if ( configAddr.isLocalHost() != grid.allowLocalHost() ) {
- out() << "cannot mix localhost and ip addresses in configdbs" << endl;
+ log() << "cannot mix localhost and ip addresses in configdbs" << endl;
return 10;
}
}
catch ( DBException& e) {
- out() << "configdb: " << e.what() << endl;
+ log() << "configdb: " << e.what() << endl;
return 9;
}
}
diff --git a/src/mongo/util/log.h b/src/mongo/util/log.h
index 6f341cabb49..b61913a0d32 100644
--- a/src/mongo/util/log.h
+++ b/src/mongo/util/log.h
@@ -85,11 +85,6 @@ namespace logger {
}
- /**
- * Synonym for log().
- */
- inline LogstreamBuilder out() { return log(); }
-
#define MONGO_LOG(DLEVEL) \
if (!(::mongo::logger::globalLogDomain())->shouldLog(::mongo::LogstreamBuilder::severityCast(DLEVEL))) {} \
else LogstreamBuilder(::mongo::logger::globalLogDomain(), getThreadName(), ::mongo::LogstreamBuilder::severityCast(DLEVEL))
diff --git a/src/mongo/util/mmap_win.cpp b/src/mongo/util/mmap_win.cpp
index a95549614af..cff26e52f03 100644
--- a/src/mongo/util/mmap_win.cpp
+++ b/src/mongo/util/mmap_win.cpp
@@ -539,7 +539,7 @@ namespace mongo {
success = FALSE != FlushFileBuffers(_fd);
if (!success) {
int err = GetLastError();
- out() << "FlushFileBuffers failed: " << errnoWithDescription( err )
+ log() << "FlushFileBuffers failed: " << errnoWithDescription( err )
<< " file: " << _filename << endl;
dataSyncFailedHandler();
}
diff --git a/src/mongo/util/net/listen.cpp b/src/mongo/util/net/listen.cpp
index 579b89b8f2c..c97ba77f614 100644
--- a/src/mongo/util/net/listen.cpp
+++ b/src/mongo/util/net/listen.cpp
@@ -162,7 +162,7 @@ namespace mongo {
{
const int one = 1;
if ( setsockopt( sock , SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)) < 0 )
- out() << "Failed to set socket opt, SO_REUSEADDR" << endl;
+ log() << "Failed to set socket opt, SO_REUSEADDR" << endl;
}
#endif
diff --git a/src/mongo/util/net/sock.cpp b/src/mongo/util/net/sock.cpp
index a1b9d8dd9bd..5d83431f5ad 100644
--- a/src/mongo/util/net/sock.cpp
+++ b/src/mongo/util/net/sock.cpp
@@ -939,7 +939,6 @@ namespace mongo {
WinsockInit() {
WSADATA d;
if ( WSAStartup(MAKEWORD(2,2), &d) != 0 ) {
- out() << "ERROR: wsastartup failed " << errnoWithDescription() << endl;
log() << "ERROR: wsastartup failed " << errnoWithDescription() << endl;
_exit(EXIT_NTSERVICE_ERROR);
}