Help on printing error messages to a log file

Hi, may I know whether is there any way to print the error messages to a log file? Thanks for your help!
[111 byte] By [noobboya] at [2007-11-27 7:40:16]
# 1
CROSS POSTED!Multiple times by a chronic cross posting idiot who has already been asked to not do that.
cotton.ma at 2007-7-12 19:20:45 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...