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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:17:33+00:00 2026-05-30T04:17:33+00:00

Using java and made a small test server to log incoming user connections. Adding

  • 0

Using java and made a small test server to log incoming user connections.

Adding the MongoDb as Databas and the log4j mongo appender log4j.properties
text file configured to save the Log class to Mongo.

Everything is nice.

I can now search among all Log Collections and trace a particular user based on the “message”

I immediately thought that it could be cool to log each individual user event to respective UserData Collection Document.
Users are also stored in the mongo as a UserData class Collection.

Why i think about this is because its hard to trace user log activity if you have multiple threads all writing to the same Log Collection.

When a user loggin i wanted to attach/append the user to a new Logger and let this logger live as long as user is on the server.

Is this what the MongoDbPatternLayoutAppender is all about?
The documentations and tutorials about this is sparse maybe someone can explain?
Am i on the right track here?

What’s best to do?

  • 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-30T04:17:35+00:00Added an answer on May 30, 2026 at 4:17 am

    This answer is not related to MongoDB in particular…

    If you’re willing to try LogBack you could use a SiftingAppender that does exactly what you’re looking for!

    For logging best practices (slf4j, log4j, LogBack, etc) you can take a look at this document here.

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

Sidebar

Related Questions

I made this small Java program using eclipse IDE. I have set the workspace
I made a custom http server using java. It runs properly on XP machines
I have made an application using Java/Hibernate/MySQL, but whenever I try running it, it
How would I be able to handle downloads using HttpResponse in Java? I made
I made an android project using eclipse. It looks like: src/ ActivityMain.java lib/ Square.java
Using Java, how can I test that a URL is contactable, and returns a
I am using Java 1.4 with Log4J. Some of my code involves serializing and
I made a small change to an old java file in IntelliJ and when
I have made a java application and wants to generate log files so whenever
I'm currently maintaining a small-medium sized java web application (using only plain JSPs/Servlets) that

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.