Results 1 to 2 of 2
- 12-16-2008, 10:35 PM #1
Member
- Join Date
- Dec 2008
- Posts
- 1
- Rep Power
- 0
- 12-19-2008, 05:10 AM #2
Senior Member
- Join Date
- Nov 2008
- Posts
- 286
- Rep Power
- 5
Firstly, I'd advise not literally trying to have any old thread write to the log file. Create a single logger thread that takes lines from a queue and a method that lets other threads pass lines to be logged to it. (See my example here of using a BlockingQueue to create a logger thread.)
Then, to know which thread wrote the line, write something like the thread name at the beginning of the line. When you create your threads, remember to set their name to something useful.Neil Coffey
Javamex - Java tutorials and performance info
Similar Threads
-
adding values from file to multi-dimensional ArrayList
By sebo in forum New To JavaReplies: 7Last Post: 09-26-2011, 11:29 PM -
Writing to DAT or TXT file
By hunterbdb in forum Advanced JavaReplies: 7Last Post: 10-12-2008, 02:50 PM -
swapping the contents of the file and writing to another file
By Ms.Ranjan in forum New To JavaReplies: 9Last Post: 07-10-2008, 04:52 PM -
A generic framework for a flexible, multi-threaded server
By Java Tip in forum java.netReplies: 0Last Post: 04-07-2008, 08:14 PM -
writing to a file
By bugger in forum New To JavaReplies: 1Last Post: 11-11-2007, 02:49 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks