How do I send log4cplus appender output to a memor

2019-06-11 16:57发布

问题:

I'm writing a logger that works for both managed and unmanaged code so I'm using log4cplus under the Test Driven Development (TDD) paradigm with Visual Studio 2013 Unmanaged Code Unit Tests under Test Explorer. Trouble is, I can't figure out how to send log4cplus output to the Assert statements.

How do I send log4cplus output to a memory buffer that I can access in the Unit Tests?

If I have to write a customized appender , what would that look like?

回答1:

You would have to create your own appender implementation that does that. To do this, inherit from Appender and implement append().