Part of this question was already asked here: Joomla >1.7 hide log messages from browser
The Problem:
In my extension, I want to create a custom logger. For that, I do the following:
JLog::addLogger(array(
'text_file' => 'plg_system_myplg.log.php',
JLog::ALL,
array('myplg')
));
and subsequently, to log something:
$log->addEntry(array('comment' => $someMsg, 'level' => $someLogLevel));
My problem is, that in my log file (plg_system_myplg.log.php), some messages completely unrelated to my plugin show up; e.g.:
... NOTICE Can't identify browser version. Agent: ...
or
... INFO FinderIndexerAdapter::getTypeId
The common thing about them is that they get entered without a category.
Initially, I had a single string as last parameter to addLogger
; and that, I thought, was the root cause (as described in my solution here:
https://stackoverflow.com/a/22238973/671366). However, even with that fixed (see above the array('myplg')
, I see those unrelated log entries being written to my logfile.
Anybody got an idea how to get rid of these superfluous error messages (preferrably by a change in my extension)? Am I doing something wrong in the code shown above? Or is this maybe a Joomla bug?
The only option to fix this at the moment seems to change the Joomla core to log those messages with a category; if I add a category on the addEntry
calls for these messages, they don't appear anymore in my logfile!