| 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 | |
@Override | @Override | ||||
public void run() | public void run() | ||||
{ | { | ||||
lg.fine("Run "+ data.getId()); | |||||
lg.fine("Run "+ data.getId()); | |||||
while (true) | while (true) | ||||
{ | { | ||||
while (!laufend) | while (!laufend) | ||||
{ | { | ||||
synchronized (LOCK) | synchronized (LOCK) |
{ | { | ||||
try (InputStream configFile = OhmLogger.class.getClassLoader().getResourceAsStream("config.properties")) { | try (InputStream configFile = OhmLogger.class.getClassLoader().getResourceAsStream("config.properties")) { | ||||
if (configFile != null) { | 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(); | ConsoleHandler ch = new ConsoleHandler(); | ||||
ch.setFormatter(new OhmFormatter()); | ch.setFormatter(new OhmFormatter()); | ||||
lg.setUseParentHandlers(false); | lg.setUseParentHandlers(false); | ||||
lg.getHandlers(); | lg.getHandlers(); | ||||
lg.addHandler(ch); | 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 { | } else { | ||||
System.err.println("Unable to find config.properties file. OhmLogger will use default settings."); | System.err.println("Unable to find config.properties file. OhmLogger will use default settings."); |
log.level=INFO | log.level=INFO | ||||
log.directory=../Aufgabe7_bandit | |||||
log.filename=ohmLog | |||||
# Beispiel f\u00fcr verschiedene Level f\u00fcr unterschiedliche Pakete | # Beispiel f\u00fcr verschiedene Level f\u00fcr unterschiedliche Pakete | ||||
# log.level.bandit.Zahlengenerator=FINE | # log.level.bandit.Zahlengenerator=FINE | ||||
# log.level.bandit.Model.Wuerfel=WARNING | # log.level.bandit.Model.Wuerfel=WARNING |