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 3458932
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:02:42+00:00 2026-05-18T10:02:42+00:00

How can I log the User Principal in my Log4J Log with Grails? I

  • 0

How can I log the User Principal in my Log4J Log with Grails?

I want to see the name of the current login when an exception occurs, ie logging the current principal on each action would not work. I need the username stored so when an exception occurs the User Name can be in the Log Pattern.

  • 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-18T10:02:43+00:00Added an answer on May 18, 2026 at 10:02 am

    I assume you should go with log4j’s Nested Diagnostic Contexts (NDC). See the respective chapter in http://logging.apache.org/log4j/1.2/manual.html.

    The idea is to create a grails filter hat manages NDC data (push/pop) upon every request and use %x in your logger’s pattern, see http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PatternLayout.html.

    By doing so, you have separated the burden of logging from the controller/service login.

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

Sidebar

Related Questions

I want in my wordpress website that user can log in through their facebook
I have an application where the user can log in. The login needs to
How can I log in user from page header without making my own login
I implemented the ASP.NET user controls. Each user can log in and update their
In my application I have a login page were the user can log in.
I have an application where the user can log in but i don't want
Is there any way I can log a Wordpress user in given only their
In our client/server application, a user can log in using a username/password. The server
Using KB180548 in a native c++ application, the user can log in in this
i want users can log in my website throw FB connect ON MOBILE but

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.