logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Watts <...@cliftonfarm.org>
Subject Re: logging parallel threads
Date Mon, 15 Oct 2012 15:16:44 GMT
Again, this isn't a logging problem you're describing.  You should be
looking to some sort of database for solutions.  You could probably
torture log4j into doing some of this but there's no advantage to it.
There are better suited tools for the problem you describe.


On Mon, 2012-10-15 at 00:43 -0700, pa7751 wrote:
> Hi
> 
> Basically I have an xml document that contains many tasks. As each of these
> tasks gets executed, I log in a file (which is again an xml) whether the
> task got successfully completed. So the first question is that whether log4j
> can be used for this?
> 
> Next since these tasks can also be executed in parallel by the engine, I
> want to know how logging can be done to a single log file.
> 
> Third, since for each of the tasks we will be recording a status like
> 'begin', 'end' to signify that a thread started or a thread completed
> execution or a thread that stared but did not complete execution maybe due
> to a sudden power failure etc. Since this will be done for every task, there
> will be many edits happening to the log file. Then how can we ensure that
> the structure of the xml remains correct
> 
> Fourth, considering the many edits/inserts happening in the xml, how can we
> get a good performance?
> 
> 
> Tim Watts-3 wrote:
> > 
> > On Sat, 2012-10-13 at 05:55 -0700, pa7751 wrote:
> >> Hi
> >> 
> >> I need some help to know if log4j can be used in the following scenarios
> >> and
> >> how
> >> 
> >> 1. In my application there are many small tasks that I need to do, say
> >> for
> >> e.g., 100. At every task, I need to log to an xml file, the structure of
> >> which I have to define. Is this possible using log4j?
> >> 
> >> 2. Since every task has to write to the same log file, and many of these
> >> tasks could be executing in parallel, how can I ensure the integrity of
> >> the
> >> structure of the xml log file i.e. if I have an <activity> tag and
> >> activity
> >> can have more activities or tasks, then can I ensure that tasks get
> >> added/deleted only to the activity that I suggest for parallel running
> >> tasks?
> >> 
> >> 3. Considering the multiple updates happening to the xml file i.e. at
> >> every
> >> task, the xml file will be edited so does that mean that the DOM is
> >> created
> >> in memory for every task. So how will performance be impacted? Is there
> >> any
> >> way we can get good performance?
> > 
> > Presumably you're targeting log4j 1.2.x.
> > 
> > Are you thinking of using o.a.log4j.xml.XMLLayout?  Doesn't sound like
> > it.
> > 
> > You write about adding & deleting activities, and editing the xml
> > output.  This doesn't sound like a logging problem.  It sounds like
> > you're trying to capture "current state" not "a history of events".  The
> > latter fits a logging problem, the former does not.  So I would say
> > log4j is probably not the right tool given your problem description.
> > Maybe if you restructure the problem it could simplify things for you?
> > 
> > That said, log4j can support multi-threaded /logging/ efficiently.
> > 
> > 
> > 
> >  
> > 
> 


Mime
View raw message