if you do
redirect('myfile.lot')
the result of "print" statements will still go to stdout.
If you do
from java.io import File
from java.io import FileOutputStream
f = File("./wlst.log")
fos = FileOutputStream(f)
theInterpreter.setOut(fos)
print "start the script"
(see https://forums.oracle.com/forums/thread.jspa?threadID=826716)
you will be able to send everything to the file.
The problem is how to get back to normal mode of operations... apart from restarting WLST, I mean.
One way could be
prev = theInterpreter.getOut()
theInterpreter.setOut(fos)
....
theInterpreter.setOut(prev)
Wednesday, August 17, 2011
Subscribe to:
Post Comments (Atom)
3 comments:
Hi
This is great working script... I am looking for a feature that needs to be included in deployment automations. For development/testing environments, the frequency of deployments are quite high... I was wondering if there was a way a log the events that happen from start to end of a deployment in DEBUG mode and store it in a log file. I can send this file to the developers for troubleshooting purposes if a deployments fails or does not work as per their expectations.
I tried this solution..
http://www.javamonamour.org/2011/08/wlst-redirecting-all-output-to-file.html
but it just logs the print commands of the script. I was wondering if it can also include the java deployment logs in this...
I have been looking for a way to do this... but with my limited scripting skills I am finding it hard to find a solution... can u provide some help..
Thanks
Anto
probably the simplest way is to launch wlst from a shell script which redirects ALL to a file:
wlst myscript.py > mylog.log 2>&1
This is what I do anyway and it works so far... maybe not very elegant, but it works...
Thanks a lot ! I was looking for this.
Post a Comment