My application uses log4cplus for logging.
When I launch it in CMD or PowerShell, logging is ok, line by line.
I decided to add small filtering function in PS, to make the output colorful.
# Simplified version
function ColoredOutput
{
process { Write-Host $_ -ForegroundColor Yellow }
}
After this I launch the app as following:
myapp.exe | ColoredOutput
The problem is that now I get log messages in chunks for about several messages at a time, not line by line. I cannot understand what triggers the actual output.
Looks to me like some buffering of the output. Any ideas?
UPD: The problem seems to be related to some messages logged using simple std::cout in C++ instead of the logger.
UPD2: I start thinking that it's actually C++ that triggers the output. As you can see from the image below, the last message is from std::cout, all the previous - from log4cplus.