It is easy. These should take care of watchdog, HTTP 404 response code and other related things.
**For Drupal 6 & 7**
In your module's page callback, do: `return drupal_not_found();`
**For Drupal 8**
In the `class::method()` referred to in the `_controller` definition (i.e. the page callback or the method responsible for generating output for the request), do:
`throw new \Symfony\Component\HttpKernel\Exception\NotFoundHttpException();`
**References**
* [drupal_not_found() documentation for Drupal 6][1].
* [drupal_not_found() documentation for Drupal 7][2].
* [NotFoundHttpException documentation for Drupal 8][3].
[1]:
[To see links please register here]
[2]:
[To see links please register here]
[3]:
[To see links please register here]