SuiteCRM logging system

Hi all,

I have noticed that there is confusion over logging message in the logger.
In below line it’s saying that it is an Error but in the message it is written as Warning .

Is it possible mistake while writing code. It should be either Warning OR Error?

This bit is the message that you get displayed in your suitecrm.log file: "Warning: Multiple links found for relationship {$this->name} within module {$module} "

$GLOBALS[‘log’]->error (in this case error) merely decides whether the logger will record the error message or not. There is a range of different levels that can be set in the config.php file. By default the logger only reports fatal:

  'logger' =>
  array (
    'level' => 'fatal',

but you can change this to debug and you’ll get waaaaaay too much information to work through. Therefore some of use tweak the logger message level from time to time as part of the development and bug fixing process. More info can be found here:

Thanks for the reply.

The question is, it is quite confusing why logging error is adding message which indicates its a warning.
The message really an error or warning ?
If it is warning then error logged should be with $GLOBALS[‘log’]->warn(in this case warning)

The error logging level that is actually logged is based on the level of logging required. Perhaps it would have made more sense to you if the error levels had been named levels 1,2,3,4,5 etc. The error message itself generally includes the words ERROR, WARNING, NOTICE, DEBUG or equivalent.

Whats happened here is that for what ever reason the person decided that a different level of notification was required in the logs than the logging level appeared to indicate.

The text of the message should never contain the words fatal, error, warning etc. It makes it a lot harder to grep properly. The message should just use the proper type and then omit any type-words from the text itself.

exactly. this creates confusion to the reader that is it an error or warning…

In an ideal world that would be great, because the logger inserts the error level in front of the message, but like many pieces of software ‘We stand on the shoulders of giants’, and the underlying library will produce an E_WARN, E_ERROR, E_FATAL or similar which ends up being included in the reported message. Yes - I agree it can be confusing.

Yes, and that’s ok. That’s what I want to use to grep. As long as those crucial words don’t appear anywhere else.