DOS Log using System.out.println()
by Michael Thomas
(Tutorial Home Page)
This set of files is an example use DOS to create a log from Java's
System.out.println(). This may be helpful during development and
debugging.
Files involved:
- MyDosLogSystemOut.java - simple .java file for testing this example.
public class MyDosLogSystemOut {
public static void main( String [] args ) {
System.out.println( "Example of Dos logging of System.out.println()" );
for ( int x=1; x < 30; x++ ) {
System.out.println("" + x + ". Example");
}
}
}
- MyDosLogSystemOut_compile.bat - Example of batch file that logs compile
errors.
Contents of File:
javac MyDosLogSystemOut.java > MyDosLogSystemOut_compile.log 2>&1
type MyDosLogSystemOut_compile.log
pause
- MyDosLogSystemOut_run.bat - Example of batch file that logs run time info
using Java's System.out.println()
Contents of File:
set JavaDosLogSystemOut=MyDosLogSystemOut_run.log
echo ############################################ >> %JavaDosLogSystemOut%
date /T >> %JavaDosLogSystemOut%
time /T >> %JavaDosLogSystemOut%
java MyDosLogSystemOut >> %JavaDosLogSystemOut% 2>&1
type %JavaDosLogSystemOut%
pause