Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2006

Tip: Looking for answers? Try searching our database.

Logging threads

Thread view: 
Matthew - 21 Jul 2006 07:29 GMT
Hello... I have 2 classes: one is a threaded class and the other is my
main class. My main class will execute 3 instances of the threaded
class simultaneously. How will I log these 3 threads SEPARATELY? Please
help . . . Thank you . . .
Ed - 21 Jul 2006 10:43 GMT
Matthew skrev:

> Hello... I have 2 classes: one is a threaded class and the other is my
> main class. My main class will execute 3 instances of the threaded
> class simultaneously. How will I log these 3 threads SEPARATELY? Please
> help . . . Thank you . . .

Can you post your code?

The simplest solution would be to have your main class create three
different Log instances and pass them to the three different threaded
instances in their constructors.

--
www.EdmundKirwan.com - Home of The Fractal Class Composition.

Download Fractality, free Java code analyzer:
www.EdmundKirwan.com/servlet/fractal/frac-page130.html
Sebastian Millies - 21 Jul 2006 13:06 GMT
Am 21 Jul 2006 02:43:09 -0700 schrieb Ed:

> Matthew skrev:
>
[quoted text clipped - 8 lines]
> different Log instances and pass them to the three different threaded
> instances in their constructors.

Depends on what you mean by separately. With log4j you could also use
a single log instance logging to a single file and distinguish the log
entries by the Thread IDs (e.g. using Nested Diagnostic Contexts).
-- Sebastian
Matthew - 22 Jul 2006 03:39 GMT
> Depends on what you mean by separately. With log4j you could also use
> a single log instance logging to a single file and distinguish the log
> entries by the Thread IDs (e.g. using Nested Diagnostic Contexts).
> -- Sebastian

Hello, Mr. Sebastian. Is it really safe to use Nested Diagnostic
Contexts? I found this article    "Think again before adopting the
commons-logging API" in http://www.qos.ch/logging/thinkAgain.jsp ...
Sorry, I'm not familiar.
Sebastian Millies - 25 Jul 2006 12:24 GMT
Am 21 Jul 2006 19:39:24 -0700 schrieb Matthew:

>> Depends on what you mean by separately. With log4j you could also use
>> a single log instance logging to a single file and distinguish the log
[quoted text clipped - 5 lines]
> commons-logging API" in http://www.qos.ch/logging/thinkAgain.jsp ...
> Sorry, I'm not familiar.

Well, that article is concerned with using commons logging,
which doesn't support Nested Diagnostic Contexts, which are
a feature of log4j. -- Sebastian


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.