Options
How to do error logging in plugin?
Can anyone point me in the right direction for writing to vanilla's error log when there is an error in a plugin?
0
Comments
$Configuration['Garden']['Errors']['LogEnabled'] = TRUE; $Configuration['Garden']['Errors']['LogFile'] = 'logs/error-log'; $Configuration['Garden']['Errors']['MasterView'] = 'deverror.master.php';
if it were java I would do...
Logger logger = Logger.getLogger("package.classname");
if(error condition){
logger.error("Descriptive error text here to track down problem.");
}
Good question. Maybe it's in the /docs how to do that, otherwise it should be in there (after we've figured it out how it works :-) )
There was an error rendering this rich post.
throw new Exception($Msg, $Code);
$Code is optional and would be something like '404' if it's a page not found (and would redirect to that route accordingly), and the message would be what gets logged. I think? Have never looked at the error log, honestly, just shooting blindly based on the code I've seen.