@@ -0,0 +1,15 @@ | |||
| 2023-11-28T11:37:42.390252 | INFO | bandit.Schnittstelle.StartStopController | Start gedruekt | | |||
| 2023-11-28T11:37:42.393278400 | INFO | bandit.Model.Zahlengenerator | Generator gestartet | | |||
| 2023-11-28T11:37:43.136932500 | INFO | bandit.Schnittstelle.StartStopController | Stop gedrueckt | | |||
| 2023-11-28T11:37:43.137930 | INFO | bandit.Model.Zahlengenerator | Generator gestopt | | |||
| 2023-11-28T11:37:43.143407 | WARNING | bandit.Model.Zahlengenerator | unlucky -> 522 | | |||
| 2023-11-28T11:38:59.188169300 | INFO | bandit.Schnittstelle.StartStopController | Start gedruekt | | |||
| 2023-11-28T11:38:59.189224300 | INFO | bandit.Model.Zahlengenerator | Generator gestartet | | |||
| 2023-11-28T11:39:00.790984600 | INFO | bandit.Schnittstelle.StartStopController | Stop gedrueckt | | |||
| 2023-11-28T11:39:00.791922600 | INFO | bandit.Model.Zahlengenerator | Generator gestopt | | |||
| 2023-11-28T11:39:00.800778 | WARNING | bandit.Model.Zahlengenerator | unlucky -> 463 | | |||
| 2023-11-28T11:39:02.989252600 | INFO | bandit.Schnittstelle.StartStopController | Start gedruekt | | |||
| 2023-11-28T11:39:02.990717700 | INFO | bandit.Model.Zahlengenerator | Generator gestartet | | |||
| 2023-11-28T11:39:04.198394300 | INFO | bandit.Schnittstelle.StartStopController | Stop gedrueckt | | |||
| 2023-11-28T11:39:04.214775 | INFO | bandit.Model.Zahlengenerator | Generator gestopt | | |||
| 2023-11-28T11:39:04.215990800 | WARNING | bandit.Model.Zahlengenerator | unlucky -> 544 | |
@@ -68,9 +68,10 @@ public class Wuerfel implements Runnable // Callable | |||
@Override | |||
public void run() | |||
{ | |||
lg.fine("Run "+ data.getId()); | |||
lg.fine("Run "+ data.getId()); | |||
while (true) | |||
{ | |||
while (!laufend) | |||
{ | |||
synchronized (LOCK) |
@@ -54,16 +54,27 @@ public class OhmLogger | |||
{ | |||
try (InputStream configFile = OhmLogger.class.getClassLoader().getResourceAsStream("config.properties")) { | |||
if (configFile != null) { | |||
Properties properties = new Properties(); | |||
properties.load(configFile); | |||
java.util.logging.Level classLogLevel = java.util.logging.Level.parse(properties.getProperty("log.level")); | |||
ConsoleHandler ch = new ConsoleHandler(); | |||
ch.setFormatter(new OhmFormatter()); | |||
lg.setUseParentHandlers(false); | |||
lg.getHandlers(); | |||
lg.addHandler(ch); | |||
lg.setLevel(classLogLevel); | |||
Properties properties = new Properties(); | |||
properties.load(configFile); | |||
java.util.logging.Level classLogLevel = java.util.logging.Level.parse(properties.getProperty("log.level")); | |||
lg.setLevel(classLogLevel); | |||
String logDirectory = properties.getProperty("log.directory"); | |||
String logFileName = properties.getProperty("log.filename"); | |||
FileHandler fileHandler = new FileHandler(logDirectory + "/" + logFileName, true); | |||
fileHandler.setFormatter(new OhmFormatter()); | |||
lg.addHandler(fileHandler); | |||
} else { | |||
System.err.println("Unable to find config.properties file. OhmLogger will use default settings."); |
@@ -1,4 +1,8 @@ | |||
log.level=INFO | |||
log.directory=../Aufgabe7_bandit | |||
log.filename=ohmLog | |||
# Beispiel f\u00fcr verschiedene Level f\u00fcr unterschiedliche Pakete | |||
# log.level.bandit.Zahlengenerator=FINE | |||
# log.level.bandit.Model.Wuerfel=WARNING |