Prepend TimeStamp to STDERR & STDOUT to a file

Currently I am redirecting STDERR and STDOUT to a log file by doing the following

{
My KSH script contents
}  2>&1 | $DEBUGLOG 

Problem is the STDERR & STDOUT do not have any date/time associated.

I want this to be something that i can embed into a script opposed to an argument I use when i run the script because non-technical users are running these so I have to keep what they are doing to a bare minimum.

EDIT: Needs to work on RedHat, Solaris & HP-UX

What's your system?

Added to OP

Maybe this is of use:

From the thread:

About the only thing that's going to work the same way in all three is perl.

#!/usr/bin/perl

use POSIX qw(strftime);


while(!eof(STDIN))
{
        $line=<STDIN>;
        print strftime("%F %T ", localtime), $line;
}

Redirect a stream through this script and it will add timestamps to it.