(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;
|
||||
|
||||
public class ConfigLoader {
|
||||
private static final Logger logger = LoggerFactory.getLogger(ConfigLoader.class);
|
||||
|
||||
static Path getConfigPath(String configName) {
|
||||
return WmsaHome.getHomePath().resolve("conf/properties/" + configName + ".properties");
|
||||
@ -17,14 +16,13 @@ public class ConfigLoader {
|
||||
|
||||
static void loadConfig(Path configPath) {
|
||||
if (!Files.exists(configPath)) {
|
||||
logger.info("No config file found at {}", configPath);
|
||||
System.err.println("No config file found at " + configPath);
|
||||
return;
|
||||
}
|
||||
|
||||
logger.info("Loading config from {}", configPath);
|
||||
System.out.println("Loading config from " + configPath);
|
||||
|
||||
try (var is = Files.newInputStream(configPath)) {
|
||||
logger.info("Config:\n{}", Files.readString(configPath));
|
||||
System.getProperties().load(is);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
|
@ -15,7 +15,7 @@ import java.net.UnknownHostException;
|
||||
* They must also invoke init() in their main method.
|
||||
*/
|
||||
public abstract class MainClass {
|
||||
private static final Logger logger = LoggerFactory.getLogger(MainClass.class);
|
||||
private final Logger logger = LoggerFactory.getLogger(MainClass.class);
|
||||
|
||||
static {
|
||||
// Load global config ASAP
|
||||
|
Loading…
Reference in New Issue
Block a user