joomla/joomla-cms — pull request #2948 by garyamort (2014-01-29 19:26:48+00:00)
Title: RFC: Fallback to messagequeue on failure

If one of the loggers for JLog is unable to create a log entry, JLog aborts.

Many components and classes blindly create formattedtext logs and just assume they will work. If the log path is not writable[for example, deployed to Google App Engine] this means Joomla! will die under certain configurations.

Proposal:
This adds a check in the constructor for JLogLoggerFormattedtext which ensures that the file path it is trying to use is writable. If not, it will throw a RuntimeException.

JLog::addLogEntry is modified:
The creation of a new logger is wrapped in try/catch to check for a RuntimeException.

If there is a RuntimeException, then it will change the log type to messagequeue and use a messagequeue log instead[so as to capture any log data]
Additionally, messageQueue will immediately add a new log entry indicating the file log failure.
Note: if there is a RuntimeException AND the log type is messagequeue then JLog will throw the exception since there is no fallback log.