RFileLogger

Login to reply to this topic.
Tue, 2005-04-05 16:25
Joined: 2004-10-28
Forum posts: 14
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.

Tue, 2005-04-05 17:24
Joined: 2004-06-06
Forum posts: 205
RFileLogger
cant you just close session, copy file, delete old log and open new session?

Best regards,
Michal Laskowski

Wed, 2005-04-06 07:13
Joined: 2004-10-28
Forum posts: 14
RFileLogger
That is just I do:

Code:
// log file creation
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).
Wed, 2005-04-06 11:54
Joined: 2004-11-02
Forum posts: 52
RFileLogger
HELP!  Cry

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

Mon, 2005-07-11 23:21
Joined: 2004-05-26
Forum posts: 20
Re: RFileLogger
what you have done is right but you should wait for a random amount of time (couple of milliseconds) before you copy the file becuase it does take some amount of time for ilog.closelog() to take effect. you do not need to do ifilelogger.close()

Gowtham
Mon, 2007-03-12 12:41
Joined: 2006-08-09
Forum posts: 49
Re: RFileLogger
Try to read this article about RFileLogger :
http://www.geckim.com/symbian/symbian-logfile-rfilelogger.htm

Bye....
  • Login to reply to this topic.