added some logging

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2025-04-07 09:58:39 +02:00
parent 313e5c522f
commit 7e3b6bbf32
5 changed files with 16 additions and 1 deletions

View File

@@ -7,7 +7,7 @@ plugins {
dependencies{
implementation("org.json:json:20240303")
implementation("de.srsoftware:tools.http:1.5.4")
implementation("de.srsoftware:tools.logging:1.2.0")
implementation("de.srsoftware:tools.logging:1.3.0")
implementation("de.srsoftware:tools.optionals:1.0.0")
implementation("de.srsoftware:tools.util:1.3.1")
implementation(project(":de.srsoftware.oidc.api"))

View File

@@ -9,6 +9,7 @@ import static de.srsoftware.tools.Optionals.nullable;
import static de.srsoftware.tools.Paths.configDir;
import static de.srsoftware.tools.Strings.uuid;
import static java.lang.System.Logger.Level.ERROR;
import static java.lang.System.Logger.Level.INFO;
import static java.lang.System.getenv;
import static java.util.Optional.empty;
@@ -51,6 +52,7 @@ public class Application {
private static final System.Logger LOG = System.getLogger("Application"); // new ColorLogger("Application").setLogLevel(DEBUG);
public static void main(String[] args) throws Exception {
LOG.log(INFO,"Starting LightOIDC…");
var argMap = map(args);
Optional<Path> basePath = argMap.get(BASE_PATH) instanceof Path p ? Optional.of(p) : empty();
var configDir = configDir(APP_NAME);
@@ -63,6 +65,8 @@ public class Application {
var firstUser = new User(FIRST_USER, firstHash, FIRST_USER, "%s@internal".formatted(FIRST_USER), FIRST_UUID).add(MANAGE_CLIENTS, MANAGE_PERMISSIONS, MANAGE_SMTP, MANAGE_USERS);
if (encryptionKey.isPresent()) LOG.log(INFO,"Encryption key is set, using encrypted database.");
FileStoreProvider fileStoreProvider = new FileStoreProvider(passHasher);
var userService = setupUserService(config, encryptionKey, defaultFile, fileStoreProvider, passHasher).init(firstUser);
var sessionService = setupSessionService(config, defaultFile, fileStoreProvider);

View File

@@ -12,10 +12,12 @@ import java.util.Optional;
import org.json.JSONObject;
public class Configuration {
private static final System.Logger LOG = System.getLogger(Configuration.class.getSimpleName());
private final JSONObject json;
private final Path storageFile;
public Configuration(File storage) throws IOException {
LOG.log(System.Logger.Level.INFO,"Using configuration from {}",storage);
storageFile = storage.toPath();
if (!storage.exists()) {
var parent = storage.getParentFile();