Friday, August 19, 2011

Redirecting the Eclipse/Flex Builder Console output to a log file



Usually we write some Java standalone programs / try to debug some web applications in Eclipse, which will generate lots of SOP / log statements. The console has a limited amount of capacity of displaying logs (even though we can change the capacity). Also if we run it again the previous console output will go away. In these cases we would require the output of the console to be written to one log file in the hard disk. You can do this in the following way :

In the eclipse Run / Debug configurations dialogue box, on the right side, you can see several tabs, where you will provide classpath, parameters, etc.
Click on the last tab, labelled as ‘Common’.
Look for the control group with title ‘Standard input and output’. There you can see one checkbox with label ‘File’.
Checking on this will activate the text box next to it. You can give the path of the log file in that text box.
You can otherwise select a directory from either workspace or file system using the corresponding buttons under that.

Don’t forget to check on the ‘Append’ checkbox if you want the log file to be keep on appending.

Now click on ‘RUN’ and you can see the new log file generated on the selected location.

Happy Coding

No comments:

Post a Comment