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:13]
# 1
STDERR redirection, writing to one directly in your catch blocks (and/or whatever), using a logger. Choose one.
masijade.a at 2007-7-12 19:20:41 > top of Java-index,Java Essentials,Java Programming...
# 2
use log4j... http://supportweb.cs.bham.ac.uk/documentation/tutorials/docsystem/build/tutorials/log4j/log4j.htmlthis might prove useful to you...
@@CKM@@a at 2007-7-12 19:20:41 > top of Java-index,Java Essentials,Java Programming...
# 3
noobboy,Please refrain from crossposting all of your questions into multiple forums. You were asked to stop this the last time you did this as well. Please be more considerate in future.
cotton.ma at 2007-7-12 19:20:41 > top of Java-index,Java Essentials,Java Programming...