Ok, i know that i am doing something wrong and if possible would like to be pointed in the right direction. Im just learning java, my background is in c/c++.
I need to be able to add custom levels to the logger and im defiantly doing it wrong. Couldnt find much on the internet about it.
Any help would be greatly appreciated. Here is my code so far.
import java.util.Scanner; import java.util.logging.FileHandler; import java.util.logging.Level; import java.util.logging.Logger; import java.io.*; public class LogRunner { public static void main(String[] args) { // This is what i could come up with so far but its wrong. // Create the new levels final Level LogRunner debug = new LogRunner(); final Level LogRunner error = new LogRunner(); try{ FileHandler hand = new FileHandler("application.log"); Logger log = Logger.getLogger("log_file"); log.addHandler(hand); log.debug("This is bad debug it! "); log.info("Here is the info "); log.warning("DANGER DANGER "); log.error("There seems to be an error "); System.out.println(log.getName()); } catch(IOException e){} } }
Thanks in advance for any help
seanman