diff --git a/plugins/TestingList.java b/plugins/TestingList.java index 1c5cff6..3d96a1f 100644 --- a/plugins/TestingList.java +++ b/plugins/TestingList.java @@ -41,6 +41,8 @@ import java.io.IOException; import java.io.InputStream; import java.nio.file.Paths; import java.util.Properties; +import java.util.logging.FileHandler; +import java.util.logging.SimpleFormatter; import javax.swing.JFileChooser; public class TestingList extends Panel { @@ -90,7 +92,28 @@ public class TestingList extends Panel { public class NetbeansPluginPanel extends MonitoredPanel { + + Logger logger = Logger.getLogger("TestsLog"); + + private void initLogger(){ + try { + FileHandler fh; + // This block configure the logger with handler and formatter + fh = new FileHandler(getClass().getResource("/log/TestsLog").toString()); + logger.addHandler(fh); + SimpleFormatter formatter = new SimpleFormatter(); + fh.setFormatter(formatter); + // the following statement is used to log any messages + logger.info("My first log"); + + } catch (SecurityException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } + public NetbeansPluginPanel() throws IOException { initComponents(); buildTable(); @@ -131,12 +154,15 @@ public class TestingList extends Panel { switch(status){ case "Success": iconSource = "/icons/button_ok-16px.png"; + logger.log(Level.INFO, "Test "+ testName + " result: " + res + "(" + status + ")"); break; case "Failed": iconSource = "/icons/button_close-16px.png"; + logger.log(Level.SEVERE, "Test "+ testName + " result: " + res + "(" + status + ")"); break; case "Running": iconSource = "/icons/button_play-16px.png"; + logger.log(Level.INFO, "Test "+ testName + " running... "); break; } ImageIcon icon = new ImageIcon(getClass().getResource(iconSource)); @@ -390,7 +416,7 @@ public class TestingList extends Panel { } public void logMessage(String message){ - + } public void selectFile(){