Here is my code, I am wondering why it isn't logging anything. When I type into the console it says:
Hello
Apr 08, 2013 10:13:47 PM java.util.logging.LogManager$RootLogger log
INFO: Hello
However, nothing is being logged to any files.
import java.io.IOException;
import java.util.Scanner;
import java.util.logging.FileHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;
public class main {
public static void main(String[] args) throws IOException{
while (1 == 1) {
String text;
Scanner in = new Scanner(System.in);
text = in.nextLine();
FileHandler fileTxt;
SimpleFormatter formatterTxt;
Logger logger = Logger.getLogger("");
logger.setLevel(Level.INFO);
fileTxt = new FileHandler("../loggedText.txt");
formatterTxt = new SimpleFormatter();
fileTxt.setFormatter(formatterTxt);
logger.addHandler(fileTxt);
logger.info(text);
}
}
}