Hello,

I want to log the 404 URL that has been tried to accessed in the error
handler plugin.
It should also work if, for example an action forwards the request to a 404
url.

I tried to log $_SERVER['REQUEST_URI'] , $this->_request->getActionName()
and $this->_request->getRequestUri()

But all of these won't have the desired log because if for example in the
indexAction function of TestController I forward to a 404 Url, I will log :

2007-12-02T17:50:22+01:00 WARN (4): /myBaseUrl/test    => 
$_SERVER['REQUEST_URI']
2007-12-02T17:50:22+01:00 WARN (4): error                   => 
$this->_request->getActionName()
2007-12-02T17:50:22+01:00 WARN (4): /myBaseUrl/test    => 
$this->_request->getRequestUri() 

I have not the url of the 404 page :(
Thank you for any help !


        public function errorAction() {
        $errors = $this->_getParam('error_handler');

        switch ($errors->type) {
            case
Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
            case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
                // 404 error -- controller or action not found
                $this->getResponse()->setRawHeader('HTTP/1.1 404 Not
Found');
                                
                [...] // get $log

                // $log->warn( $_SERVER['REQUEST_URI'] );
                // $log->warn( $this->_request->getActionName() );
                // $log->warn( $this->_request->getRequestUri() );
                break;
                [...]
        }
    }
-- 
View this message in context: 
http://www.nabble.com/Get-the-404-URL-in-the-errorAction-plugin-controller-tf4932325s16154.html#a14117364
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to