I am aware that i can log using tee
But I want to log from inside my script, at the same time display the content on the stdout also.
Example, my code looks something like this:
    names=$(print("name1 name2 name3 name4"))
    for name in names
    do
       echo "Current Name: " $name 
       related_job= ps -ef | grep $name | awk '{print $9}' >> File.dat
       echo "related job: " $related_job
    done 
Now, this block will certainly echo at stdout but i even want to log this to a log file, say script_name.log.
Also, i am calling script through a scheduler and sue to come constraint i can't use script_name | tee log_file . I can just call the script by script name.
What could be the solution to it?