How redirect output(error and normal) to 2 different files

Hello,

I have a java program which i am calling in shell script. I wanted to redirect output to 2 differetn files. Output should have both 1 & 2 (normal and error) in both file.

pls help

exec 2>&1 file1.out # This will log everything
echo "something" 2>&1 file2.out # This will log the output of the command only

I didn't understand very well... If you want two files, one for the output and one for the errors, try:

./your_command 2>err_file.txt 1>out_file.txt

Otherwise, if you want to redirect both stderr and stdout to a single logfile, try:

./your_command >log_file.txt 2>&1