[FEAT] Bridge 'JDK logging API' to 'SLF4J'

This commit is contained in:
Edouard DUPIN 2025-01-05 21:53:42 +01:00
parent 0260b4d408
commit 98d213b01e
4 changed files with 20 additions and 1 deletions

View File

@ -22,6 +22,13 @@
<artifactId>archidata</artifactId> <artifactId>archidata</artifactId>
<version>0.19.1-SNAPSHOT</version> <version>0.19.1-SNAPSHOT</version>
</dependency> </dependency>
<!-- Loopback of logger JDK logging API to SLF4J -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
<version>2.0.9</version>
</dependency>
<!-- generic logger of SLF4J to console (in color) -->
<dependency> <dependency>
<groupId>ch.qos.logback</groupId> <groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId> <artifactId>logback-classic</artifactId>

View File

@ -2,6 +2,7 @@ package org.kar.karusic;
import java.net.URI; import java.net.URI;
import java.util.Iterator; import java.util.Iterator;
import java.util.logging.LogManager;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import javax.imageio.ImageReader; import javax.imageio.ImageReader;
@ -41,6 +42,7 @@ import org.kar.karusic.migration.Migration20250104;
import org.kar.karusic.migration.Migration20250105; import org.kar.karusic.migration.Migration20250105;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.slf4j.bridge.SLF4JBridgeHandler;
import jakarta.ws.rs.core.UriBuilder; import jakarta.ws.rs.core.UriBuilder;
@ -75,6 +77,10 @@ public class WebLauncher {
} }
public static void main(final String[] args) throws Exception { public static void main(final String[] args) throws Exception {
// Loop-back of logger JDK logging API to SLF4J
LogManager.getLogManager().reset();
SLF4JBridgeHandler.install();
WebLauncher.LOGGER.info("[START] application wake UP"); WebLauncher.LOGGER.info("[START] application wake UP");
final WebLauncher launcher = new WebLauncher(); final WebLauncher launcher = new WebLauncher();
launcher.migrateDB(); launcher.migrateDB();

View File

@ -1,6 +1,7 @@
package org.kar.karusic; package org.kar.karusic;
import java.util.List; import java.util.List;
import java.util.logging.LogManager;
import org.kar.archidata.api.DataResource; import org.kar.archidata.api.DataResource;
import org.kar.archidata.api.ProxyResource; import org.kar.archidata.api.ProxyResource;
@ -18,6 +19,7 @@ import org.kar.karusic.api.TrackResource;
import org.kar.karusic.api.UserResource; import org.kar.karusic.api.UserResource;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.slf4j.bridge.SLF4JBridgeHandler;
public class WebLauncherLocal extends WebLauncher { public class WebLauncherLocal extends WebLauncher {
private static final Logger LOGGER = LoggerFactory.getLogger(WebLauncherLocal.class); private static final Logger LOGGER = LoggerFactory.getLogger(WebLauncherLocal.class);
@ -35,6 +37,10 @@ public class WebLauncherLocal extends WebLauncher {
} }
public static void main(final String[] args) throws Exception { public static void main(final String[] args) throws Exception {
// Loop-back of logger JDK logging API to SLF4J
LogManager.getLogManager().reset();
SLF4JBridgeHandler.install();
// Generate the APIs in type-script
generateObjects(); generateObjects();
final WebLauncherLocal launcher = new WebLauncherLocal(); final WebLauncherLocal launcher = new WebLauncherLocal();
launcher.process(); launcher.process();

View File

@ -25,7 +25,7 @@ export const Icon = forwardRef<IconProps, 'span'>(
maxWidth={sizeIcon} maxWidth={sizeIcon}
maxHeight={sizeIcon} maxHeight={sizeIcon}
align="center" align="center"
padding="1%" padding="1px"
ref={ref} ref={ref}
{...rest}> {...rest}>
<Box <Box