Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log 500 errors #62

Closed
koichirose opened this issue May 6, 2013 · 5 comments
Closed

Log 500 errors #62

koichirose opened this issue May 6, 2013 · 5 comments

Comments

@koichirose
Copy link

It seems that my Apache is not correctly logging 500 errors generated by minify, for example when a JS file has a syntax error and the compiler can't minify it.

I'm using ClosureCompiler:

$min_serveOptions['minifiers']['application/x-javascript'] = array('Minify_JS_ClosureCompiler', 'minify');

All my other 500 errors seem to be correctly reported in /var/log/apache2/error.log.
I tried debugging a little but I'm not sure where to look nor I'm sure it's a minify issue.

@mrclay
Copy link
Owner

mrclay commented May 6, 2013

Closure Compiler uses an HTTP API. I'm not sure how much error handling I've built into that wrapper.

@mrclay
Copy link
Owner

mrclay commented May 6, 2013

By default, errors trigger a fallback compression via JSMin: https://github.com/mrclay/minify/blob/master/min/lib/Minify/JS/ClosureCompiler.php#L58

@koichirose
Copy link
Author

Yeah, but the browser only reports a 500 error. How can I log that $response somewhere?

It occurs, for example, in calls like this:

$("#stats").dataTable({
    "sPaginationType": "full_numbers",
    "aoColumnDefs": [ 
                { "iDataSort": sortIndex, "aTargets": [ sortIndexTargets ] }
    ],
    "bJQueryUI": true, //notice this last comma
});

@mrclay
Copy link
Owner

mrclay commented May 6, 2013

In min/config.php, try this:

class MyLogger {
    public function log($msg, $label) {
        error_log("$label: $msg");
    }
}
$min_errorLogger = new MyLogger();

@koichirose
Copy link
Author

this works great, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants