Archived
0

System out/err to SLF4j

This commit is contained in:
2017-04-27 06:20:14 +03:00
parent 8b725d0f69
commit d3adfca333
2 changed files with 6 additions and 1 deletions

View File

@@ -22,6 +22,7 @@ jar {
dependencies {
included group: 'org.slf4j', name: 'slf4j-api', version: slf4jVersion
included group: 'uk.org.lidalia', name: 'sysout-over-slf4j', version: '1.0.2'
runtime group: 'org.slf4j', name: 'slf4j-simple', version: slf4jVersion
included group: 'org.apache.felix', name: 'org.apache.felix.framework', version: '5.6.1'

View File

@@ -10,6 +10,7 @@ import org.apache.felix.framework.util.ImmutableMap;
import org.osgi.framework.BundleActivator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import uk.org.lidalia.sysoutslf4j.context.SysOutOverSLF4J;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
@@ -39,6 +40,7 @@ public class Core {
private void startFelix() {
logger.trace("starting Apache Felix (OSGi)");
SysOutOverSLF4J.sendSystemOutAndErrToSLF4J();
try {
felix = new Felix(createFelixConfig());
@@ -73,7 +75,7 @@ public class Core {
@PreDestroy
public void stop() {
startFelix();
stopFelix();
}
private void stopFelix() {
@@ -85,5 +87,7 @@ public class Core {
} catch (Exception e) {
logger.error("Error shutdown Felix", e);
}
SysOutOverSLF4J.restoreOriginalSystemOutputs();
}
}