jeudi 4 janvier 2018

Java Logger Makes New txt File Everytime

#other code & randomizer
if(outcome == 1){
                    Logger logger = Logger.getLogger("MyLog");
                    FileHandler fh;
                    fh = new FileHandler("C:\\Temp\\Dice_roll\\Logs.txt", true);
                    logger.addHandler(fh);
                    logger.setLevel(Level.ALL);
                    SimpleFormatter formatter = new SimpleFormatter();
                    fh.setFormatter(formatter);
                    logger.log(Level.INFO, "Outcome 1.");
{

This is supposed to add more text into the txt file, which it does. BUT, it also makes another txt file called Log.txt.1 and then if I roll it again, Log.txt.2 and so on. How would I fix this?

Any help will be much appreciated.




Aucun commentaire:

Enregistrer un commentaire