On 13/10/12 14:55, 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?
I don't know if it is possible to have each thread contains its own logger?
Currently I have a logger that is attached to each class I write.
If one of my classes is "threaded" I guess I could somehow create the
logger with the details of the thread number for the current running
instance of the app (in fact this should be quite easy using a couple of
class members to count the number of threads being created)
I know that is is possible for each logger to log to its own
personalised log file (or to a general shared one).
Why not use this to log each "threaded Class" to its own personal log
file. Then you just need to "clean up" the log files occasionally to
pull them into a single file.
As Tisha suggests an in memory DB may be useful for this as you could
sort the created tables by the time of the action and join across each
of them.
Also you can set your personalised structure as required by the
structure of you DB table.
You may even be able to force the DB table names to "rotate" over time
(or use a trigger when a table gets to a given size - can that be
done?), enabling you to perform your select and join across the tables
without having to worry about locking the tables.
David
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org