2

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!

Community
  • 1
  • 1
codeling
  • 11,056
  • 4
  • 42
  • 71
  • Is this on a clean Joomla installation? Or do you have things like Akeeba and RocketTheme installed (which I've found override the JLog functionality)? – Craig Apr 05 '14 at 00:51
  • I have some extensions installed, but none of the ones you mention. Will try with a clean one – codeling Apr 08 '14 at 10:35
  • I would suggest you to try solution mentioned here http://forum.joomla.org/viewtopic.php?f=706&t=774242#p3190343 – Irfan Sep 11 '14 at 20:23
  • an interesting approach, but that plugin only seems to remove the message from the output to the user, but not from the log (also see the question linked by me above: this question is about the logfile, not user-shown messages!); and that workaround also is specific for the "Can't identify browser version" message, and wouldn't work for the "FinderIndexerAdapter..." message; and anyway, my goal is to find a generic solution for only showing log messages from my plugin in its logfile. I'm somehow more and more convinced that this is actually a bug in Joomla core, will have to dig into that :( – codeling Sep 11 '14 at 22:37

0 Answers0