Listing 2: LogFileTest.java — Tests the LogFile class

import java.io.*;

class LogFileTest
{
    public static void main(String[] args)
    {
        LogFile log = new LogFile(args[0]);

        try
        {
            log.log("A First message");
            log.log("WARNING", "A second message");
        }
        catch (IOException e)
        {
            System.out.println("Error: " + e.getMessage());
        }
    }
}

/* Contents of args[0]:
Mon Nov 27 13:11:35 MST 2000: A First message
Mon Nov 27 13:11:35 MST 2000: WARNING: A second message
*/
— End of Listing —