mirror of
https://github.com/jneug/zeichenmaschine.git
synced 2026-04-14 14:43:33 +02:00
Rechtschreibung und standard Log-Format
This commit is contained in:
@@ -77,7 +77,7 @@ public final class Log {
|
|||||||
*/
|
*/
|
||||||
public static void enableGlobalLevel( Level level ) {
|
public static void enableGlobalLevel( Level level ) {
|
||||||
int lvl = Validator.requireNotNull(level).intValue();
|
int lvl = Validator.requireNotNull(level).intValue();
|
||||||
ensureRootLoggerIntialized();
|
ensureRootLoggerInitialized();
|
||||||
|
|
||||||
// Decrease level of root level ConsoleHandlers for output
|
// Decrease level of root level ConsoleHandlers for output
|
||||||
Logger rootLogger = Logger.getLogger("");
|
Logger rootLogger = Logger.getLogger("");
|
||||||
@@ -116,22 +116,24 @@ public final class Log {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Log getLogger( Class<?> clazz ) {
|
public static Log getLogger( Class<?> clazz ) {
|
||||||
ensureRootLoggerIntialized();
|
ensureRootLoggerInitialized();
|
||||||
return new Log(clazz);
|
return new Log(clazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ensureRootLoggerIntialized() {
|
private static void ensureRootLoggerInitialized() {
|
||||||
if( LOGGING_INIT ) {
|
if( LOGGING_INIT ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( System.getProperty("java.util.logging.SimpleFormatter.format") == null ) {
|
||||||
|
System.setProperty("java.util.logging.SimpleFormatter.format", DEFAULT_LOG_FORMAT);
|
||||||
|
}
|
||||||
Logger rootLogger = Logger.getLogger(ROOT_LOGGER);
|
Logger rootLogger = Logger.getLogger(ROOT_LOGGER);
|
||||||
rootLogger.setLevel(Level.INFO);
|
rootLogger.setLevel(Level.INFO);
|
||||||
|
|
||||||
if( System.getProperty("java.util.logging.SimpleFormatter.format") == null
|
if( System.getProperty("java.util.logging.SimpleFormatter.format") == null
|
||||||
&& LogManager.getLogManager().getProperty("java.util.logging.SimpleFormatter.format") == null ) {
|
&& LogManager.getLogManager().getProperty("java.util.logging.SimpleFormatter.format") == null ) {
|
||||||
System.setProperty("java.util.logging.SimpleFormatter.format", DEFAULT_LOG_FORMAT);
|
// System.setProperty("java.util.logging.SimpleFormatter.format", DEFAULT_LOG_FORMAT);
|
||||||
//rootLogger.addHandler(new StreamHandler(System.err, new LogFormatter()));
|
|
||||||
rootLogger.addHandler(new StreamHandler(System.err, new LogFormatter()) {
|
rootLogger.addHandler(new StreamHandler(System.err, new LogFormatter()) {
|
||||||
@Override
|
@Override
|
||||||
public synchronized void publish(final LogRecord record) {
|
public synchronized void publish(final LogRecord record) {
|
||||||
@@ -139,7 +141,7 @@ public final class Log {
|
|||||||
flush();
|
flush();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
rootLogger.setUseParentHandlers(false);
|
// rootLogger.setUseParentHandlers(false);
|
||||||
}
|
}
|
||||||
if( rootLogger.getUseParentHandlers() ) {
|
if( rootLogger.getUseParentHandlers() ) {
|
||||||
// This logger was not configured somewhere else
|
// This logger was not configured somewhere else
|
||||||
|
|||||||
Reference in New Issue
Block a user