summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTad Marshall <tad@10gen.com>2012-12-07 04:29:43 -0500
committerDan Pasette <dan@10gen.com>2013-01-08 03:10:32 -0500
commitd5a4514a067350e10d17f83a15178a09fa662669 (patch)
treee0a3fd2c91b60ff665b2de9db14861d8ce05021b
parentf7afbab2c3fcb54475a6d3c12065f7b36a3f5065 (diff)
downloadmongo-d5a4514a067350e10d17f83a15178a09fa662669.tar.gz
SERVER-7869 Report errno and description on file rename failure
Also report target filename on rename failure at startup, add missing 'endl' to logRotate rename failure log line.
-rw-r--r--src/mongo/util/log.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/mongo/util/log.cpp b/src/mongo/util/log.cpp
index 980bb6a5490..840ec57dd47 100644
--- a/src/mongo/util/log.cpp
+++ b/src/mongo/util/log.cpp
@@ -90,10 +90,13 @@ namespace mongo {
string s = ss.str();
if ( ! rename( lp.c_str() , s.c_str() ) ) {
- cout << "log file [" << lp << "] exists; copied to temporary file [" << s << "]" << endl;
+ cout << "log file [" << lp
+ << "] exists; copied to temporary file [" << s << "]" << endl;
} else {
- cout << "log file [" << lp << "] exists and couldn't make backup; run with --logappend or manually remove file (" << strerror(errno) << ")" << endl;
-
+ cout << "log file [" << lp
+ << "] exists and couldn't make backup [" << s
+ << "]; run with --logappend or manually remove file: "
+ << errnoWithDescription() << endl;
return false;
}
}
@@ -137,7 +140,9 @@ namespace mongo {
ss << _path << "." << terseCurrentTime( false );
string s = ss.str();
if (0 != rename(_path.c_str(), s.c_str())) {
- error() << "Failed to rename " << _path << " to " << s;
+ error() << "Failed to rename '" << _path
+ << "' to '" << s
+ << "': " << errnoWithDescription() << endl;
return false;
}
}