The applications using log4cpp crashes if they touch file size limit (2Gb-1).
How about changing the FileAppender.cpp as attached?
Logged In: NO
Somehow attached file didn't get uploaded. Here are the two functions we can change as:
FileAppender::FileAppender(const std::string& name, const std::string& fileName, bool append, mode_t mode) : LayoutAppender(name), _fileName(fileName), _flags(O_CREAT | O_APPEND | O_WRONLY | O_LARGEFILE), _mode(mode) { if (!append) _flags |= O_TRUNC; if((_fd = ::open(_fileName.c_str(), _flags, _mode)) < 0) { if(EINVAL == errno) { // LARGEFILE not supported !! tulsi_rammayala@strongmail.com _flags &= ~O_LARGEFILE; _fd = ::open(_fileName.c_str(), _flags, _mode); } } }
bool FileAppender::reopen() { if (_fileName != "") { int fd = ::open(_fileName.c_str(), _flags, _mode); if (fd < 0) { if(EINVAL == errno) { // LARGEFILE not supported !! tulsi_rammayala@strongmail.com _flags &= ~O_LARGEFILE; return reopen(); } else { return false; } } else { if (_fd != -1) ::close(_fd); _fd = fd; return true; } } else { return true; } }
Log in to post a comment.
Logged In: NO
Somehow attached file didn't get uploaded. Here are the two
functions we can change as:
FileAppender::FileAppender(const std::string& name,
const std::string& fileName,
bool append,
mode_t mode) :
LayoutAppender(name),
_fileName(fileName),
_flags(O_CREAT | O_APPEND | O_WRONLY | O_LARGEFILE),
_mode(mode) {
if (!append)
_flags |= O_TRUNC;
if((_fd = ::open(_fileName.c_str(), _flags, _mode))
< 0) {
if(EINVAL == errno) { // LARGEFILE not
supported !! tulsi_rammayala@strongmail.com
_flags &= ~O_LARGEFILE;
_fd = ::open(_fileName.c_str(), _flags, _mode);
}
}
}
bool FileAppender::reopen() {
if (_fileName != "") {
int fd = ::open(_fileName.c_str(), _flags, _mode);
if (fd < 0) {
if(EINVAL == errno) { // LARGEFILE not
supported !! tulsi_rammayala@strongmail.com
_flags &= ~O_LARGEFILE;
return reopen();
} else {
return false;
}
} else {
if (_fd != -1)
::close(_fd);
_fd = fd;
return true;
}
} else {
return true;
}
}