diff options
author | Jose <jose@zeroc.com> | 2016-04-07 19:22:10 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2016-04-07 19:22:10 +0200 |
commit | 7a5970ada31094087fef0494cac624c5610558de (patch) | |
tree | 2a7d28544baa2468c612fd460de6f0da117c1976 /cpp/src/Ice/LoggerI.cpp | |
parent | Do not throw if log rotation fails. (diff) | |
download | ice-7a5970ada31094087fef0494cac624c5610558de.tar.bz2 ice-7a5970ada31094087fef0494cac624c5610558de.tar.xz ice-7a5970ada31094087fef0494cac624c5610558de.zip |
Windows build fixes
Diffstat (limited to 'cpp/src/Ice/LoggerI.cpp')
-rw-r--r-- | cpp/src/Ice/LoggerI.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/cpp/src/Ice/LoggerI.cpp b/cpp/src/Ice/LoggerI.cpp index c35e84fee18..6ce48d0338c 100644 --- a/cpp/src/Ice/LoggerI.cpp +++ b/cpp/src/Ice/LoggerI.cpp @@ -78,7 +78,7 @@ Ice::LoggerI::LoggerI(const string& prefix, const string& file, { throw InitializationException(__FILE__, __LINE__, "FileLogger: cannot open " + _file); } - + if(_sizeMax > 0) { _out.seekp(0, _out.end); @@ -163,7 +163,7 @@ Ice::LoggerI::write(const string& message, bool indent) // but we do not archive empty files or truncate messages. // size_t sz = static_cast<size_t>(_out.tellp()); - if(sz > 0 && sz + message.size() >= _sizeMax && + if(sz > 0 && sz + message.size() >= _sizeMax && (_nextRetry == 0 || _nextRetry <= IceUtil::Time::now().toMilliSeconds())) { @@ -203,17 +203,17 @@ Ice::LoggerI::write(const string& message, bool indent) } int err = IceUtilInternal::rename(_file, archive); - + _out.open(_file, fstream::out | fstream::app); - + if(err) { _nextRetry = retryTimeout + IceUtil::Time::now().toMilliSeconds(); // // We temporally set the maximum size to 0 to ensure that there isn't any rename attempts // in the nested error call. - // - int sizeMax = _sizeMax; + // + size_t sizeMax = _sizeMax; _sizeMax = 0; sync.release(); error("FileLogger: cannot rename " + _file + "\n" + IceUtilInternal::lastErrorToString()); @@ -224,7 +224,7 @@ Ice::LoggerI::write(const string& message, bool indent) { _nextRetry = 0; } - + if(!_out.is_open()) { sync.release(); |