Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make 404 pages not write an error log?

In our philosophy, an error log is always caused by a programmer error.

In Play 1.2.x, prod mode, any access to a non-existing page will trigger an error log:

ERROR (play) ~ 
MyController.myAction action not found
Action not found
Action MyController.myAction could not be found. Error raised is No method public static void myAction() was found in class controllers.MyController
play.exceptions.ActionNotFoundException: Action MyController.myAction not found
    at play.mvc.ActionInvoker.getActionMethod(ActionInvoker.java:604)
    at play.mvc.ActionInvoker.resolve(ActionInvoker.java:85)
    at Invocation.HTTP Request(Play!)
Caused by: java.lang.Exception: No method public static void myAction() was found in class controllers.MyController

How can I configure Play not to issue an error log in this cases? Maybe a WARN log level, at most?

like image 297
ripper234 Avatar asked Jun 21 '12 09:06

ripper234


1 Answers

The code for logging this is located in ActionInvoker.java(play 1.2.5RC4):

catch (ActionNotFoundException e) {
            Logger.error(e, "%s action not found", e.getAction());
            throw new NotFound(String.format("%s action not found", e.getAction()));
        }

So it seems there is no way to adjust the logging level of the ActionNotFoundException. I agree that this should not be at the 'error' level. I would recommend opening up a ticket at https://play.lighthouseapp.com/dashboard.

like image 179
seePatCode Avatar answered Oct 04 '22 01:10

seePatCode