How ?
How to create a thread to log , log things like ip and user name that send message to a server ?
[103 byte] By [
EuSuzi] at [2007-9-30 19:30:16]

Please use a more descriptive subject when asking questions.
There are several ways of doing this, here are two:
* Make a static Log class, set up a thread in the class you want to log and call the Log methods in certain time intervals.
* Make the log class with a thread and a pointer to the class you want to monitir and make logs at time intervals.
-s
Before reinventing the wheel, or should I say, the log, check out [url= http://logging.apache.org/]Log4j[/url] and the [url= http://java.sun.com/j2se/1.5.0/docs/guide/logging/overview.html]J2SE 's logging API[/url].
Sorry I will be clear in the nex time.but, how can I your tips, I mean , code in Java?
Are you asking how to write code? What have you written in Java to date?
> Are you asking how to write code? What have you> written in Java to date?I've eaten a date and several figs. Does that count?
Come to think of it, when I was in Java, I feasted on [url= http://en.wikipedia.org/wiki/Salak]salak[/url]. Can't find them here in North America :-(
Sorry, I齧 not an expert in Java and I can not find anything in my books
Did you check the links in reply 2?
Java's logging API is pretty easy, but you are vague: what do you have so far, what kind of server do youhave, what protocols are you using, etc... etc... And of course: why do you want to do this?
It齭 something that my teacher asked me to do.I create a server and a client (socket issue) a client send information to the server and it will be necessary the server record the data from client like ip , user ............
My reply to nasch_ I齧 reading that right now
Is your question on how to log, or how to find out the client's IP address and "user name"? If it's
the latter, and I assume you are using java.net.Socket, take a look at it's API. There is a method
that will give you the Inet address of the client. From that you can find their IP address, but the
"user name" is not automatically sent. You'll have to have your client write that down the socket.
Have a look at http://java.sun.com/j2se/1.3/docs/api/java/net/Socket.html and http://java.sun.com/j2se/1.3/docs/api/java/net/InetAddress.html. The java.net.Socket and java.net.InetAddress classes have methods that return IP information.
AvaB at 2007-7-6 23:44:30 >

Hello.Thank you everybody. The answers were very usefull to me.I齧 just writing my *.java.Thanks so much