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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:27:09+00:00 2026-05-14T22:27:09+00:00

In my program I have 2 separate streams of logging events (calling them streams

  • 0

In my program I have 2 separate streams of logging events (calling them streams for simplicity, in reality its 2 appenders). Stream1 contains client logging and Stream2 contains control logging. Now this might seem easy, except that certain classes can be both in the client logging and server logging, depending on the situation. Complicating this further is the fact that a command that a client wants takes place in 2 separate threads (one being fetched randomly from a thread pool), so any kind of tracking with MDC or NDC isn’t possible.

What would really simplify this is if the logger could inherit the appenders from the calling instance. That way I can setup 2 appenders for 2 loggers and be done. However I have no idea how to do it cleanly or easily. Can anyone offer any advice on how to do so?

Note: If something needs to be passed around, I do have a event bean that gets passed to everything in the chain that can be used if necessary.

  • 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-14T22:27:10+00:00Added an answer on May 14, 2026 at 10:27 pm

    You’ve already mentioned that the client processing takes place in multiple threads, so a simple ThreadLocal approach might not work… but would a ThreadGroupLocal work?

    See [Are there thread group-local variables in Java?

    The tact I am suggesting is to only have one appender registered with the logging framework. That appender would be something you write. The implementation would delegate to the ThreadLocal/ThreadGroupLocal appender. The that appender would be client- or control-specific.

    Also note that your appender should not be configured beneath asynchronous or batching abstractions.

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

Sidebar

Related Questions

I have a program that starts constantly juggles between 3 separate timers. The main
I am trying to separate a few things in here. I have a program
I have a program that draws shapes on an image. I have a separate
I have two separate functions, bar() and foo(). The execution flow of my program
Since I have many separate classes for my program I created 2 folders (I'm
I have two separate processes: a C program that outputs comma separated values followed
I have a python program that opens several urls in seperate tabs in a
I am developing two java programs that run in separate VM's that have a
I have program written in C. It takes 2 arguments username/password and try to
I have program that requires Python 3, but I develop Django and it uses

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.