Use same logging configuration approach as with runner.
This commit is contained in:
parent
0669aa3daa
commit
5928371fc9
4 changed files with 34 additions and 9 deletions
|
|
@ -13,6 +13,10 @@ dependencies {
|
|||
implementation 'org.jgrapes:org.jgrapes.io:[2.5.0,3)'
|
||||
implementation 'org.jgrapes:org.jgrapes.http:[3.1.0,4)'
|
||||
implementation 'org.jgrapes:org.jgrapes.util:[1.28.0,2)'
|
||||
|
||||
implementation project(':org.jdrupes.vmoperator.util')
|
||||
|
||||
implementation 'commons-cli:commons-cli:1.5.0'
|
||||
}
|
||||
|
||||
application {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#
|
||||
# Ad Hoc Polling Application
|
||||
# Copyright (C) 2018 Michael N. Lipp
|
||||
# VM-Operator
|
||||
# Copyright (C) 2023 Michael N. Lipp
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
|
|
@ -16,13 +16,13 @@
|
|||
# with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
|
||||
handlers=java.util.logging.ConsoleHandler
|
||||
|
||||
org.jgrapes.level=FINE
|
||||
org.jgrapes.core.handlerTracking.level=FINER
|
||||
|
||||
org.jdrupes.vmoperator.manager.level=FINE
|
||||
|
||||
java.util.logging.ConsoleHandler.level=ALL
|
||||
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
|
||||
java.util.logging.SimpleFormatter.format=%1$tY-%1$tm-%1$td %5$s%6$s%n
|
||||
java.util.logging.SimpleFormatter.format=%1$tb %1$td %1$tT %4$s %5$s%6$s%n
|
||||
|
|
@ -19,6 +19,10 @@
|
|||
package org.jdrupes.vmoperator.manager;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.util.logging.LogManager;
|
||||
import org.jdrupes.vmoperator.util.FsdUtils;
|
||||
import org.jgrapes.core.Channel;
|
||||
import org.jgrapes.core.Component;
|
||||
import org.jgrapes.core.Components;
|
||||
|
|
@ -29,6 +33,7 @@ import org.jgrapes.io.NioDispatcher;
|
|||
|
||||
public class Manager extends Component {
|
||||
|
||||
public static final String APP_NAME = "vmoperator";
|
||||
private static Manager app;
|
||||
|
||||
public Manager() throws IOException {
|
||||
|
|
@ -51,6 +56,22 @@ public class Manager extends Component {
|
|||
System.out.println("(Done.)");
|
||||
}
|
||||
|
||||
static {
|
||||
try {
|
||||
InputStream props;
|
||||
var path = FsdUtils.findConfigFile(Manager.APP_NAME,
|
||||
"logging.properties");
|
||||
if (path.isPresent()) {
|
||||
props = Files.newInputStream(path.get());
|
||||
} else {
|
||||
props = Manager.class.getResourceAsStream("logging.properties");
|
||||
}
|
||||
LogManager.getLogManager().readConfiguration(props);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace(); // NOPMD
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The main method.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue