Click here to Skip to main content
16,004,686 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: HWND of app Pin
Maxwell Chen25-Apr-04 16:53
Maxwell Chen25-Apr-04 16:53 
GeneralRe: HWND of app Pin
Prakash Nadar25-Apr-04 18:43
Prakash Nadar25-Apr-04 18:43 
Questionhow to left circular shift ? Pin
Marco M.25-Apr-04 7:14
Marco M.25-Apr-04 7:14 
AnswerRe: how to left circular shift ? Pin
Mike Nordell25-Apr-04 7:30
Mike Nordell25-Apr-04 7:30 
GeneralGetActivedocument, debug, release Pin
Anonymous25-Apr-04 6:53
Anonymous25-Apr-04 6:53 
GeneralRe: GetActivedocument, debug, release Pin
Mike Dimmick25-Apr-04 9:31
Mike Dimmick25-Apr-04 9:31 
GeneralCreating a log file Pin
Mortis25-Apr-04 6:35
Mortis25-Apr-04 6:35 
GeneralRe: Creating a log file Pin
peterchen25-Apr-04 10:17
peterchen25-Apr-04 10:17 
For the limited size:

I found the best solution to simply use two files. If the log file exceeds it's limit, make a backup with a fixed name (overwriting previous backup, if any), and truncate it.

This is a very simple implementation, you always have "enough" past information available, and the log size never exceeds two times the set limit.

Efficiency: Don't use stream operators. (they are painfully slow. I once rewrote an entire logging package for that reason. Further, the syntax is really ugly for logging). I found printf-style fast enough.

I use simple CreateFile/WriteFile, and I *do* Flush at the end of the line. This slows down things - but using the log to debug application crashes, this is invaluable.

If this is not necessary, you could log to a memory buffer, and write out larger chunks.


Flirt harder, I'm a Coder

mlog || Agile Programming | doxygen

GeneralRe: Creating a log file Pin
f6425-Apr-04 11:17
f6425-Apr-04 11:17 
GeneralRe: Creating a log file Pin
Jason Henderson25-Apr-04 18:27
Jason Henderson25-Apr-04 18:27 
GeneralRe: Creating a log file Pin
Mortis25-Apr-04 23:56
Mortis25-Apr-04 23:56 
Generalterminating processes Pin
Ryan McDermott25-Apr-04 5:16
Ryan McDermott25-Apr-04 5:16 
GeneralRe: terminating processes Pin
valikac25-Apr-04 5:36
valikac25-Apr-04 5:36 
GeneralRe: terminating processes Pin
Paul Ranson25-Apr-04 8:34
Paul Ranson25-Apr-04 8:34 
GeneralRe: terminating processes Pin
Shree25-Apr-04 19:02
Shree25-Apr-04 19:02 
QuestionAdding text to CRicheditctrl? Pin
CodeBrain25-Apr-04 5:08
CodeBrain25-Apr-04 5:08 
AnswerRe: Adding text to CRicheditctrl? Pin
Dominik Reichl25-Apr-04 6:19
Dominik Reichl25-Apr-04 6:19 
GeneralRe: Adding text to CRicheditctrl? Pin
CodeBrain25-Apr-04 7:24
CodeBrain25-Apr-04 7:24 
GeneralOpening a document Pin
Arnav25-Apr-04 3:53
Arnav25-Apr-04 3:53 
GeneralRe: Opening a document Pin
peterchen25-Apr-04 4:05
peterchen25-Apr-04 4:05 
GeneralRe: Opening a document Pin
Mike Dimmick25-Apr-04 9:33
Mike Dimmick25-Apr-04 9:33 
GeneralCustom Cursor Pin
Anonymous25-Apr-04 1:35
Anonymous25-Apr-04 1:35 
GeneralRe: Custom Cursor Pin
Michael Dunn25-Apr-04 5:09
sitebuilderMichael Dunn25-Apr-04 5:09 
Questionwhy do i get an image fudge? Pin
YaronNir25-Apr-04 0:56
YaronNir25-Apr-04 0:56 
AnswerRe: why do i get an image fudge? Pin
ohadp25-Apr-04 3:06
ohadp25-Apr-04 3:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.