src/de/uhilger/bildhelfer/Main.java | ●●●●● patch | view | raw | blame | history | |
src/de/uhilger/bildhelfer/Verkleinerer.java | ●●●●● patch | view | raw | blame | history | |
src/logging.properties | ●●●●● patch | view | raw | blame | history |
src/de/uhilger/bildhelfer/Main.java
@@ -4,6 +4,17 @@ public class Main { /* String logFile = System.getProperty("java.util.logging.config.file"); if(logFile == null){ LogManager.getLogManager().readConfiguration(ReportGenerator.class.getClassLoader().getResourceAsStream("logging.properties")); } Logger logger = Logger.getLogger(ReportGenerator.class.getName()); logger.log(Level.INFO, "LOG THIS"); */ private static final Logger logger = Logger.getLogger(Main.class.getName()); public static void main(String[] args) { src/de/uhilger/bildhelfer/Verkleinerer.java
@@ -104,9 +104,11 @@ for(int i = 0; i < fileList.length; i++) { //System.out.println(fileList[i].getAbsolutePath()); logger.fine(fileList[i].getAbsolutePath()); File outDir = new File(outDirName); File outFile = new File(outDir, fileList[i].getName()); //System.out.println(outFile.getAbsolutePath()); logger.info(outFile.getAbsolutePath()); try { Image image = ImageIO.read(fileList[i]); MediaTracker mediaTracker = new MediaTracker(new Container()); @@ -206,14 +208,15 @@ } } catch (InterruptedException ex) { //System.out.println("Error: " + ex.getLocalizedMessage()); logger.log(Level.SEVERE, ex.getLocalizedMessage(), ex); } catch (FileNotFoundException e) { e.printStackTrace(); logger.log(Level.SEVERE, e.getLocalizedMessage(), e); } catch (IOException e) { e.printStackTrace(); logger.log(Level.SEVERE, e.getLocalizedMessage(), e); } } } else { //System.out.println("fileList is null or empty"); logger.info("fileList is null or empty"); } } } src/logging.properties
New file @@ -0,0 +1,15 @@ handlers= java.util.logging.ConsoleHandler .level= NONE # default file output is in user's home directory. java.util.logging.FileHandler.pattern = %h/java%u.log java.util.logging.FileHandler.limit = 50000 java.util.logging.FileHandler.count = 1 java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter # Limit the message that are printed on the console to FINEST and above. java.util.logging.ConsoleHandler.level = FINEST java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter de.uhilger.bildhelfer.level = NONE