P
P
pantsarny2016-02-06 14:28:09
Yii
pantsarny, 2016-02-06 14:28:09

Yii2 - how not to log an exception?

Good afternoon. There was a following problem:
From the user the request comes. Inside the action, an external API is called, and if the necessary information is not received from the API, it is necessary to throw a NotFoundHttpException to the user. But I don't want to see this exception in the logs.
I see the following solution:

Yii::$app->log->targets['file']->enabled = false;
throw new NotFoundHttpException...

Is it true?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Valery, 2016-02-06
@pantsarny

Yes, this solution, provided the correct route is specified, should solve the problem.

A
Andrey, 2016-02-06
@VladimirAndreev

and try?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question