This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Java in General and the fly likes logging parallel threads Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "logging parallel threads" Watch "logging parallel threads" New topic

logging parallel threads

Dorothy Taylor
Ranch Hand

Joined: Nov 26, 2007
Posts: 104

I want to create a log file in an xml format. I want to know that if there are many parallel threads updating(insert, edit, delete) in this file, can we ensure the integrity of the structure of the xml file? Can we use log4j for this?
Paul Clapham

Joined: Oct 14, 2005
Posts: 19869

Of course. Have the logging done by a single object, which all of the threads use, and have the logging done in a synchronized method.
Dorothy Taylor
Ranch Hand

Joined: Nov 26, 2007
Posts: 104
Thanks for the answer. Is it possible to have a custom structure for this xml log file using log4j?
I agree. Here's the link:
subject: logging parallel threads
It's not a secret anymore!