Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8361575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:43:48+00:00 2026-06-09T11:43:48+00:00

Is it possible to create/extend a CakePHP Exception handler which shows the url the

  • 0

Is it possible to create/extend a CakePHP Exception handler which shows the url the user tried to access which throws the exception?

Usually when I look into my error.log file I see something like this:

2012-08-01 13:39:20 Error: [MissingControllerException] Controller class UserController could not be found.
#0 /www/htdocs/w0081e0e/app/webroot/index.php(104): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#1 {main}

I have a working UsersController but I’m not sure which url the user tried to access which in return throw this error. It would help me to see the url in the error.log file. Is that possible? Would I have to create/extend an exception handling file?


Update:
Instead of writing my own ExceptionHandler I just updated the “handleException” function in “lib/Cake/Error/ErrorHandler.php”:

if (!empty($config['log'])) {
        $message = sprintf("[%s] %s\n%s",
            get_class($exception),
            $exception->getMessage(),
            $exception->getTraceAsString().' - http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']."\n"
        );
        CakeLog::write(LOG_ERR, $message);
    }

I know that this is overwritten once I update my CakePHP Version but its a quick fix that works really fine for my situation.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T11:43:49+00:00Added an answer on June 9, 2026 at 11:43 am

    You can write your own exception handlers. It’s pretty well documented at http://book.cakephp.org/2.0/en/development/exceptions.html#create-your-own-exception-handler-with-exception-handler

    Anyway the URL seems to be like http://something/user/something. The error says UserController could not be found, which is true as you only have a UsersController (plural). If you just want to avoid this error it might be enough to find the file which creates a /user/ URL.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to create two modules which extend the same core model like
Possible Duplicate: Create event handler for OnScroll for web browser control I would like
Is it possible to create a custom ContentProvider to Access android existing database (e.g.
Is it possible to extend the original permissions given by the user? So, once
Given the following situation it's only possible to write a model handler which works
My goal is to create a trait that a case class can extend, which
Is possible create an extension for SQL Management Studio in Visual Studio 2010? Visual
Hi it'd like to know if it's at all possible create a parametric equalizer
Possible Duplicate: Create provisioning profile in iphone application i developed my iphone app and
Possible Duplicate: Create an Array of the Last 30 Days Using PHP I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.