RFileLogger
| Tue, 2005-04-05 16:25 | |
|
Hello,
I am using RFileLogger class, but I also want to control log file size. So I have defined a class using a RFileLogger object which counts the number of lines in order to not exceed a limit. I want to copy the log file (for example: "log.txt" -> "log.old") and clean it when limit is reached. My problem is that I cannot copy the log file, CFileMan::Copy() returns KErrInUse, but before I have closed RFileLogger session. Could you help me? Thanks. |
|






Forum posts: 205
Best regards,
Michal Laskowski
Forum posts: 14
RFileLogger iLog;
iLog.Connect();
iLog.CreateLog(aDir, aFile, EFileLoggingModeOverwrite);
...
// write traces
iLog.Write(message);
...
// close, copy and create again
iLog.CloseLog();
iLog.Close();
RFs fs;
if (fs.Connect() == KErrNone) {
CFileMan *file_manager;
file_manager = CFileMan::NewL(fs);
_LIT(KFilePath, "C:\\logs\\%S\\%S");
_LIT(KNewFilePath, "C:\\logs\\%S\\%S.old");
TBuf<64> file;
file.Format(KFilePath, &aDir, &aFile);
TBuf<64> file_new;
file_new.Format(KNewFilePath, &aDir, &aFile);
file_manager->Copy(file, file_new, FileMan::EOverWrite);
}
fs.Close();
iLog.Connect();
iLog.CreateLog(aDir, aFile, EFileLoggingModeOverwrite);
But CFileMan::Copy() method returned KErrInUse error and the initial log file continue growing up (closing and connecting again didn't clean the file).
Forum posts: 52
I am using a tshell ROM image. I don't know how to start the FLogSvr.exe daemon. When I try to get a session (flogger.Connect()) without starting it, the program always leaves. Can somebody show me how to start the logger server as a daemon when kernel starts?
Many many many thanks!
NewLC #2150
Forum posts: 20
Gowtham
Forum posts: 49
http://www.geckim.com/symbian/symbian-logfile-rfilelogger.htm
Bye....