This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft 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 Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "logging parallel threads" Watch "logging parallel threads" New topic
Author

logging parallel threads

Dorothy Taylor
Ranch Hand

Joined: Nov 26, 2007
Posts: 104
Hi

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
Bartender

Joined: Oct 14, 2005
Posts: 18168
    
    8

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: http://aspose.com/file-tools
 
subject: logging parallel threads
 
Similar Threads
Multi-Core Vs. Single-Core (For the serious Java Archs)
Updating a xml file inside a jar file
does join method hinders performance
SQL Query formation problem.
Can I read a file chunks in parallel?