mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-23 13:09:00 +00:00
(MainClass) ensure logging isn't loaded before service name is known
This causes logs all to have names like ${sys:service-name}, instead of the service name...
This commit is contained in:
parent
c9fb45c85f
commit
d28fc99119
@ -9,7 +9,6 @@ import java.nio.file.Files;
|
|||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
|
||||||
public class ConfigLoader {
|
public class ConfigLoader {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ConfigLoader.class);
|
|
||||||
|
|
||||||
static Path getConfigPath(String configName) {
|
static Path getConfigPath(String configName) {
|
||||||
return WmsaHome.getHomePath().resolve("conf/properties/" + configName + ".properties");
|
return WmsaHome.getHomePath().resolve("conf/properties/" + configName + ".properties");
|
||||||
@ -17,14 +16,13 @@ public class ConfigLoader {
|
|||||||
|
|
||||||
static void loadConfig(Path configPath) {
|
static void loadConfig(Path configPath) {
|
||||||
if (!Files.exists(configPath)) {
|
if (!Files.exists(configPath)) {
|
||||||
logger.info("No config file found at {}", configPath);
|
System.err.println("No config file found at " + configPath);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info("Loading config from {}", configPath);
|
System.out.println("Loading config from " + configPath);
|
||||||
|
|
||||||
try (var is = Files.newInputStream(configPath)) {
|
try (var is = Files.newInputStream(configPath)) {
|
||||||
logger.info("Config:\n{}", Files.readString(configPath));
|
|
||||||
System.getProperties().load(is);
|
System.getProperties().load(is);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
@ -15,7 +15,7 @@ import java.net.UnknownHostException;
|
|||||||
* They must also invoke init() in their main method.
|
* They must also invoke init() in their main method.
|
||||||
*/
|
*/
|
||||||
public abstract class MainClass {
|
public abstract class MainClass {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(MainClass.class);
|
private final Logger logger = LoggerFactory.getLogger(MainClass.class);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
// Load global config ASAP
|
// Load global config ASAP
|
||||||
|
Loading…
Reference in New Issue
Block a user