Event logging to file and display to console | tee command is not able to log all info.

My intention is to log the output to a file as well as it should be displayed on the console > I have used tee ( tee -a ${filename} ) command for this purpose. This is working as expected for first few outputs, after some event loggin nothing is gettting logged in to the file but It is displaying on the console.

I can elaborate this.

echo -ne "$(date +%c) $*" >> ${filename};echo -e "Thank you for selecting Rose Model Extraction !!!\n" | tee -a ${filename}
echo -ne "$(date +%c) $*" >> ${filename};echo -e "Start of taking backups !!!\n" | tee -a ${filename}
........................
........................
echo -ne "$(date +%c) $*" >> ${filename};echo -e "Start of copying Model files !!!\n"  | tee -a ${filename}

Dashed line indicate the operation performing (code). Here in this example first two statements are displaying and logging into log file. But from third statement onwards nothing is getting logged in to the file, but is is displaying on the console. Is this because the command execution speed is more, execution is very quick.?

Thanks,
Sanoop

It sunds more like a quoting imbalance, where the te got hidden.

"  | tee -a ${filename} . . ."

I usually go for the quieter:

(
everything, but simpler -- no redirection, pipes, multiple tee's
) 2>&1 | tee ${filename-with-date-to-second}

The there is the ever favorite no tee, just log to file, and to watch:

tail -n +0 -f ${filename}

Sometimes long commands, even sub-shells and scripts, will buffer, stopping mid-line, but usually at each command end the log catches up.

Programmers can help by either calling flush() periodically to clean FILE* buffers, or initially calling setvbuf() to configure line buffering. I used to use setvbuf for a huge buffer, and flush to write whole log blocks in one piece, because I had many servers writing the same logs.

I think that we need to see lines 3+ .
My blind guess for the hidden code is that it starts another Shell.

Ps. It always helps to post what Operaing System and version you have and what Shell you are using.
The "echo -e" says some sort of Sunos to me, but there is very liitle actual Shell in the post.

For instance, if some line does something this, stdin and stdout are changed, no longer default to the display:

exec > /tmp/stdout.$$ 2> /tmp/stderr.$$

(A bad practice, in my view, as it confuses readers of subsequent lines. If you want to redirect for a while, put that bit in () or {} and redirect just that bit, temporarily.)