wood burning stoves 2.0*
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 Murach's Java Servlets and JSP this week in the Servlets 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: 18541

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