/** A thin logging system based on the {@link Logger} framework. */
class ThinLogging {
-// private static ThinLogging instance;
-
private SortedMap<String, ThinLogger> loggers = new TreeMap<>();
private NavigableMap<String, Level> levels = new TreeMap<>();
private final LogEntryPublisher publisher;
ThinLogging() {
-// if (instance != null)
-// throw new IllegalStateException("Only one logger finder cann be instantiated");
-// instance = this;
-
executor = Executors.newCachedThreadPool((r) -> {
Thread t = new Thread(r);
t.setDaemon(true);
publisher.subscribe(subscriber);
Runtime.getRuntime().addShutdownHook(new Thread(() -> close(), "Log shutdown"));
+
+ setDefaultLevel(Level.INFO);
}
protected void close() {
public void log(Level level, ResourceBundle bundle, String format, Object... params) {
// measure timestamp first
Instant now = Instant.now();
- String msg = MessageFormat.format(format, params);
+ String msg = params == null ? format : MessageFormat.format(format, params);
publisher.log(this, level, bundle, msg, null, now, findCallLocation());
}
String className = stack[i].getClassName();
switch (className) {
case "java.lang.System$Logger":
+ case "java.util.logging.Logger":
case "org.apache.commons.logging.Log":
case "org.osgi.service.log.Logger":
case "org.argeo.cms.Log":
+ case "org.slf4j.impl.ArgeoLogger":
+ case "org.eclipse.jetty.util.log.Slf4jLog":
lowestLoggerInterface = i;
continue stack;
default: