Tips & Tricks


Installation guide | Tutorial | Tips & Tricks | Support Q&A | Technical Notes | Release Notes


Distinguishing output
Running Non-Java (EXE etc)
Deleting Logs
Archiving Logs
Setting Look & Feel in dialogs

Distinguishing output

There is currently no way for jTask to distinguish the output from different invoked classes, and all output gets put into the same log. If this is important for your application, you could append a message to the beginning of all System.out.println() statements, such as System.out.println("[FROM MYCLASS]" + etc..). A simple search/replace should work fine.

Another way to go about it is to log all output to a specific file for that class, rather than using System.out.println().

Code Snippet:

FileWriter specificLog = new FileWriter("log.txt", true);
specificLog.write("Output from ...");
specificLog.flush();
specificLog.close();

Running Non-Java (EXE etc)

jTask comes with a very simple class (Exec.java) that uses the java.lang.Runtime() class to invoke executable as if invoked from the command line. To use Exec, specify the Executable as the first argument (including a path if it's not located in the jTask directory), and the arguments as arg[1], arg[2], etc..

See Exec.java (in the Classes directory) if you want to add any features to the Exec class.

Deleting Logs

jTask comes with a very simple class (LogDelete.java) which will delete the jTaskStdOut.txt and jTaskStdErr.txt files. To use it, simply create a new task whose Program is LogDelete, and schedule it to run periodically.

Archiving Logs

jTask comes with a very simple class (LogArchiver.java) which will copy the log file to Logfile_mm_dd_yy.txt. To use it, create a new task with LogArchiver in the Program column. Enter jTaskStdOut for arg[0] (don't include the file extension, it is assumed to be .txt). Finally, set it to execute periodically, such as every day at midnight.

Setting Look & Feel in dialogs

Set the String lookAndFeel to the appropriate Look & Feel:

lookAndFeel = "com.sun.java.swing.plaf.metal.MetalLookAndFeel";
lookAndFeel = "com.sun.java.swing.plaf.motif.MotifLookAndFeel";
lookAndFeel = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";

Update the Look & Feel:

UIManager.setLookAndFeel(lookAndFeel);
SwingUtilities.updateComponentTreeUI(frame);

 
 
 
 


Copyright © 1999, Branch Cut Software