Another question I have is, let say you get an exception and I want to write all exception into a log file. There is one log file, and 5 threads will be sharing. I need a way to lock it, write the log, and release the log file, so other threads can write to the logs. Can some one give me some pointers?