mirror of
https://github.com/Akomry/sae302_applicom.git
synced 2025-12-06 08:43:54 +00:00
fix(logger): utilisation des fichiers de log
This commit is contained in:
parent
f6177058e0
commit
b8cffe3831
2 changed files with 6 additions and 1 deletions
|
|
@ -6,9 +6,11 @@ import javafx.scene.Scene;
|
|||
import javafx.scene.image.Image;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.LogManager;
|
||||
|
|
@ -23,6 +25,9 @@ public class ChatApplication extends Application {
|
|||
InputStream is = ChatApplication.class
|
||||
.getResource("logging.properties").openStream();
|
||||
LogManager.getLogManager().readConfiguration(is);
|
||||
if (!Files.exists(new File("chat/target/").toPath())) {
|
||||
Files.createDirectory(new File("target").toPath());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOGGER.log(Level.INFO, "Cannot read configuration file", e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ handlers=java.util.logging.ConsoleHandler, java.util.logging.FileHandler
|
|||
java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter
|
||||
|
||||
# Nom du fichier de logs
|
||||
java.util.logging.FileHandler.pattern=target/java%u.log
|
||||
java.util.logging.FileHandler.pattern=chat/target/java%u.log
|
||||
|
||||
# Format de logs plus compact sur 1 seule ligne
|
||||
java.util.logging.SimpleFormatter.format=%1$tF %1$tT.%1$tL | %4$-7s | %2$s | %5$s %6$s%n
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue