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

  • Home
  • SEARCH
  • 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 3842074
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T15:44:31+00:00 2026-05-19T15:44:31+00:00

In grails, how can I add some code to the UrlMappings.groovy (ex: println) so

  • 0

In grails, how can I add some code to the UrlMappings.groovy (ex: println) so that I can figure out what the request URI is and which mapping is getting hit (if any)?

Background:

In this situation, there are two servers which serve different things based on file extension. So, the two servers need to always see file extensions for error processing to continue. Otherwise, the servers get confused and 1 serves up a 404 page instead of our 500 page.

The bigger picture involves taking a 500 response due to something like a NullPointerException and tracing it through the code to see what is happening.

I added code like the following which is at http://jetlet.blogspot.com/2010/08/grails-exception-handling-with-response.html :

"500" (controller: "error", action: "internalError")

In testing this, I am throwing a NullPointerException (NPE) on purpose. The 500 handling is called and 500 page is served up when entering in the URL into the browser’s address bar. However, when posting a form to the server and having the processing code blow up on purpose with a NPE, the “500” handling code does not get called. The URL in the form’s action seems to end with an extension. So, not sure why the difference in behavior between the GET (browser URL) and POST (form submission).

Thanks for insights and thoughts on tracking this down !

  • 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-05-19T15:44:31+00:00Added an answer on May 19, 2026 at 3:44 pm

    In your Config.groovy you can modify your log4j settings for url mapping events by adding

    all 'org.codehaus.groovy.grails.web.mapping'
    

    to your existing log4j settings. all is the most verbose setting so it can be tuned back if that starts giving you too much. You can find more information in the official grails documentation here : http://grails.org/doc/latest/guide/3.%20Configuration.html

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

Sidebar

Related Questions

Can someone please help me to figure out how to create domain classes for
When I try to run a grails app, I'm told that grails can't resolve
I'm trying to figure out the licensing consequences of using Grails as the base
Grails vs Rails. Which has better support? And which one is a better choice
I'm currently working with Groovy and Grails. While Groovy is pretty straight-forward since it's
I'm looking for a method or current API that allows you to add on
The select form component in grails can have the form: <g:select name=user.age from=${0..59} value=${age}
I'm attempting to add a method to a grails domain class, e.g. class Item
I'm trying to test my grails app using integration test that makes http requests.
Can I run a Grails war under Tomcat in a machine without JDK (Only

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.