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:11]
# 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:39 > top of Java-index,Java Essentials,New To Java...
# 2
> CROSS POSTED!> > Multiple times by a chronic cross posting idiot who> has already been asked to not do that.Hmm..can tell from his profile: http://forum.java.sun.com/profile.jspa?userID=920717
Jensona at 2007-7-12 19:20:39 > top of Java-index,Java Essentials,New To Java...