Does Wordpress provide different levels of logging?

(I come from a Java development background, so please excuse my lack of PHP and WordPress knowledge.)

My understanding of logging in WordPress is that it must first be enabled in wp-config.php and then calls to error_log() can be seen and read.

But logging is not just about errors. It is very useful when developing and debugging to be able to log. For this reason many Java logging libraries (e.g. SLF4J) provide the ability to log at the following levels:

  • TRACE (lowest)
  • DEBUG
  • INFO
  • WARN
  • ERROR (highest)

You can then configure the logging level that you wish to see in the log. For example when developing you would like to see DEBUG and above, but when running in production you probably just want to see WARN and above.

Is there something equivalent in WordPress? Logging everything as an error does not seem right.

Topic logging Wordpress

Category Web


Your understand is correct. WordPress doesn't have levels beyond Warning and Error from PHP.

Wonolog, a WordPress wrapper for Monolog, expands the default error logging into the levels you require. You can also expand the logging by adding your own custom debuging alerts and level.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.