Log dumped to website / CLI detection for logging buggy?!

When accessing the backend in Piwik 1.7.1 (SVN trunk), I am seeing log output dumped at the top of the website like the following:

[2012-03-07 12:39:00] [7483e6a7] [2.49 Mb] * PROCESSING Preparing archive: range(Von 2012-02-29 bis 2012-03-06), plugin VisitsSummary , not archived yet…
[2012-03-07 12:39:01] [7483e6a7] [2.51 Mb] ‘range’, idSite = 1 (definitive archive), segment = ‘’, report = ‘VisitsSummary_CoreMetrics’, UTC datetime [2012-02-28 23:00:00 -> 2012-03-06 22:59:59 ]…
[2012-03-07 12:39:01] [7483e6a7] [2.58 Mb] * ALREADY PROCESSED, Fetching idArchive = 2080 (idSite=1), for Preparing archive: day(2012-02-29), plugin VisitsSummary , Visits = 220
[2012-03-07 12:39:01] [7483e6a7] [2.60 Mb] * ALREADY PROCESSED, Fetching idArchive = 70 (idSite=1), for Preparing archive: day(2012-03-01), plugin VisitsSummary , Visits = 221
[2012-03-07 12:39:01] [7483e6a7] [2.61 Mb] * ALREADY PROCESSED, Fetching idArchive = 121 (idSite=1), for Preparing archive: day(2012-03-02), plugin VisitsSummary , Visits = 197
[2012-03-07 12:39:01] [7483e6a7] [2.61 Mb] * ALREADY PROCESSED, Fetching idArchive = 172 (idSite=1), for Preparing archive: day(2012-03-03), plugin VisitsSummary , Visits = 174
[2012-03-07 12:39:01] [7483e6a7] [2.62 Mb] * ALREADY PROCESSED, Fetching idArchive = 223 (idSite=1), for Preparing archive: day(2012-03-04), plugin VisitsSummary , Visits = 203
[2012-03-07 12:39:01] [7483e6a7] [2.63 Mb] * ALREADY PROCESSED, Fetching idArchive = 291 (idSite=1), for Preparing archive: day(2012-03-05), plugin VisitsSummary , Visits = 224
[2012-03-07 12:39:01] [7483e6a7] [2.63 Mb] * PROCESSING Preparing archive: day(2012-03-06), plugin VisitsSummary , not archived yet…
[2012-03-07 12:39:01] [7483e6a7] [2.64 Mb] ‘day’, idSite = 1 (definitive archive), segment = ‘’, report = ‘VisitsSummary_CoreMetrics’, UTC datetime [2012-03-05 23:00:00 -> 2012-03-06 22:59:59 ]…
[2012-03-07 12:39:02] [7483e6a7] [3.82 Mb] LOAD DATA INFILE failed… Error was:SQLSTATE[28000]: Invalid authorization specification: 1045 Access denied for user ‘USER’@‘HOST’ (using password: YES)

This comes from core/Archive/Single.php line 234. My workaround is to comment this line out.

My guess is that the detection of wether the output is meant for CLI or HTTP is not working properly.

I am using Debian Squeeze with the dotdeb repo for PHP (php5-fpm 5.3.10-1~dotdeb.1).

(Regarding the last line from the log snippet above I have granted the FILE priviledge to the mysql user for piwik now).

For whatever reason I had “logger_message[] = screen” in config/config.ini.php (and log_only_when_cli=0 in the global config).