Your code was not generating any repeated lines. A repeated line is only true if the last logged line on the appender is the same. There should be no memory issues because it is just a checksum of the last logged line, and two datetime variables that is stored. One datetime for the first, and one that changes every time the line is repeated. When a different checksum occurs the last checksum, and the two datetime values is replaced.

There should also be a timeout value. In my example I have a 10 second timeout.

Code:
log.Debug("Hello world");
log.Debug("Hello world");
log.Debug("Hello world");
Thread.Sleep(10500);
log.Debug("Hello world");

Output:
Hello world
Last message was repeated 2 times.
Hello world

- Morten

Ron Grabowski wrote:
Do you want to keep a count of every unique log message and append that
to the message?

Code:
log.Debug("A");
log.Debug("AB");
log.Debug("ABC");
log.Debug("ABCD");
log.Debug("A");
log.Debug("AB");
log.Debug("ABC");
log.Debug("ABCD");
log.Debug("A");
log.Debug("AB");
log.Debug("ABC");
log.Debug("ABCD");

Output:
A
AB
ABC
ABCD
A - repeated 2 times
AB - repeated 2 times
ABC - repeated 2 times
ABCD - repeated 2 times
A - repeated 3 times
AB - repeated 3 times
ABC - repeated 3 times
ABCD - repeated 3 times

Or do you want to queue up repeated lines and output them when the
repository shuts down?

A - repeated 3 times
AB - repeated 3 times
ABC - repeated 3 times
ABCD - repeated 3 times

If you queue up repeated outputs not only will they potential take up a
lot of memory, but you'd loose all of the time stamp information
associated with a logging event.

- Ron

Reply via email to