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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:35:26+00:00 2026-05-22T18:35:26+00:00

I have a MySession object (a generic Session, not web) that runs in its

  • 0

I have a MySession object (a generic Session, not web) that runs in its thread. I want to use NDC class in order to include some data taken from fields of my MySession: user that has created it, starting time etc. etc. I’d like to “render” fields into a message. Is it possible or is it supported only for messages?
Thanks in advance

public class MySession {
    String userName;
    Date startTime;

    public void doSomething() {
        NDC.push(this);                                    //cannot do something like this?
        NDC.push(this.userName 
                  + " " + startTime.toString());          //or should I do this? 
    }

}
  • 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-22T18:35:27+00:00Added an answer on May 22, 2026 at 6:35 pm

    A NDC just adds a “context” (freeform string) to all log messages (which may or may not be output depending on the logging format). The nested part means that NDC.pop() returns to the previous (next layer up) context.

    Still, at any given point the context is a single freeform string – so you’re right that you’d have to push something like this.username + '.' + this.startTime.toString(), as in your second example. You can see from the API that push takes a String argument; this context is only used in terms of being part of a logging message (implicitly a String), so there would be no benefit in accepting arbitrary objects of a different type.

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

Sidebar

Related Questions

I have set a session scope object in my session and I want to
I have a Web Application that I'm trying to move from Sun Application Server
I have a VBA function that initializes a lotus notes session, creates a document
I have two PHP scripts, both using the same session by calling session_name('MySessID') .
Have a n-tire web application and search often times out after 30 secs. How
Just starting with ASP.NET and find it difficult to use the GridView. I have
Have just started using Google Chrome , and noticed in parts of our site,
Have you ever seen any of there error messages? -- SQL Server 2000 Could
Have you guys had any experiences (positive or negative) by placing your source code/solution
Have just started using Visual Studio Professional's built-in unit testing features, which as I

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.