So i was wondering how can i make a logs system, i wanna make a log system for admins that way i can know what they do, so i really don't know where start, i can make a system to write something to a file, but how i can make a new file when the first is full ?
Just name the file by the date, and on every server reset check if the date changed and if so make a new file with the new date and log to that.
I was trying to create a Logger and set to it a FileHandler but im getting an error 'NoSuchFileException'
I thought it will create the file if not exists Edit : Now the system couldn't find out the path, wutttt. Code: logger = Logger.getLogger(getClass().getSimpleName()); logger.setLevel(Level.ALL); FileHandler handler; SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); try { Date date = new Date(); String fileName = getDataFolder() + File.separator + sdf.format(date) + ".log"; System.out.println(fileName); File file = new File(fileName); if(!file.exists()) { file.createNewFile(); } handler = new FileHandler(fileName, LIMIT, 1, true); handler.setFormatter(new SimpleFormatter()); logger.addHandler(handler); toLogger(Level.INFO, newLogLine()); } catch (IOException | SecurityException e) { e.printStackTrace(); System.out.println("[" + getClass().getSimpleName() + "] Error ocurred while loading, disabling..."); setEnabled(false); }