I have a shell script, which thorws some log messages in standard output . I want to catch that output from inside the same shell script to a log file.But here am facing a problem and the problem is : I tried :
Problem: It successfully captured the output but It stopped throwing the log messages in console. All the log messages got diverted to the stdout and stderr file which i dont need. I need the script should throw log as well as record it. Like in script command it throws logs as normal process as well as records it. Please help! Thanks ricky
I want to invoke the catch command from the inside the same file. i think in tee i need to start my install.sh script as ./install.sh | tee install.log but i dont need this too i want the to be invoked from inside only. so that i will only run ./install.sh and the command inside will capture all the out put . am able to use "exec 1 > log " from inside my script. but still as i said before i want log in both on console and in log file.
Dont know this is the right place to post this or not as its a windows thing. I've one doubt is there way or command to catch the same outputs of a batch file run, to a logfile. like echo blah blah > blah.log I mean to say like in Unix we have tee do we have a replacement in windows also. or do i need to create a function kind of thing to get a logfile from the batch file run.
I think if you can use the cygwin system, you'll find it supports "tee" under Windows. There's also a utility of 2 that does what tee does that runs in native Windows command-shell, though I don't know any names. If all else fails, tee is just a simple program that reads a line and outputs it to t different files, then repeats until end of input.
If you're referring to Java logging, however, there's another possibility. The major Java loggers (apache commons, log4j and java.util.log) have the ability to be configured to log to more than one destination, and even to log selectively to a destination. For example, all SEVERE-level messages might be routed to a printed console and to a paging system such as Big Brother, all com.oracle-class messages of might go to a DBA's audit file, [i]etc.[/]
Customer surveys are for companies who didn't pay proper attention to begin with.
but cygwin is not an option for me here. As i cant suggest a user to install cygwin before running my batch file. But what i found is its not bad idea to pack the tee.exe file from cygwin with my batch file as the size is also 23.8kb.
You can try, but tee.exe may call on other cygwin components, so I'm not sure it would work.
But, like I said, you should be able to find a DOS-native version of tee with a little searching. The main difference is that tee is part of the basic package in *n*x but not Windows. So is grep, however and I've used grep since my CP/M days!
And if all else fails, you can write your own in under an hour.