Every time when the client programs runs, it has to create a file to log the message. If it creates a file with the name say, "LogMsg", then sometimes from the same machine, if two requests are shooted, then the contents of that file will be overwritten or it can be appended (for each request). Instead of that, i want to create a file everytime with the "unique name" so that the log message will be there in that file only for that particular request. For each request, i want to create one file with the unique name. Could anyone tell how to create a unique file name every time?
One solution is to append a random number at the end of the filename like for instance LogMsg563547728 or something like that using Math.random(). Another solution, which in my opinion is the simplest, is to append the current Time in milliseconds to "LogMsg". "LogMsg"+new Date().getTime(). This way you are sure to get different files every milliseconds HIH ------------------ Valentin Crettaz Sun Certified Programmer for Java 2 Platform