本文整理汇总了Java中org.springframework.boot.logging.LoggingApplicationListener类的典型用法代码示例。如果您正苦于以下问题:Java LoggingApplicationListener类的具体用法?Java LoggingApplicationListener怎么用?Java LoggingApplicationListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LoggingApplicationListener类属于org.springframework.boot.logging包,在下文中一共展示了LoggingApplicationListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.springframework.boot.logging.LoggingApplicationListener; //导入依赖的package包/类
public static void main(String[] args) {
SpringApplicationBuilder builder = new SpringApplicationBuilder(Launcher.class);
Set<ApplicationListener<?>> listeners = builder.application().getListeners();
for (Iterator<ApplicationListener<?>> it = listeners.iterator(); it.hasNext();) {
ApplicationListener<?> listener = it.next();
if (listener instanceof LoggingApplicationListener) {
it.remove();
}
}
builder.application().setListeners(listeners);
ConfigurableApplicationContext context = builder.run(args);
LOGGER.info("collector backup start successfully");
KafkaConsumer kafkaConsumer = (KafkaConsumer<byte[], String>) context.getBean("kafkaConsumer");
Task task = (Task) context.getBean("backupTask");
// 优雅停止项目
Runtime.getRuntime().addShutdownHook(new ShutdownHookRunner(kafkaConsumer, task));
task.doTask();
}
示例2: main
import org.springframework.boot.logging.LoggingApplicationListener; //导入依赖的package包/类
public static void main(String[] args) throws InterruptedException {
SpringApplicationBuilder builder = new SpringApplicationBuilder(Launcher.class);
Set<ApplicationListener<?>> listeners = builder.application().getListeners();
for (Iterator<ApplicationListener<?>> it = listeners.iterator(); it.hasNext();) {
ApplicationListener<?> listener = it.next();
if (listener instanceof LoggingApplicationListener) {
it.remove();
}
}
builder.application().setListeners(listeners);
builder.run(args);
LOGGER.info("hi-log-log4j2 start successfully");
String a = "哈哈";
while (true) {
LOGGER.info("i am test, {}", a);
Thread.sleep(1000);
}
}
示例3: main
import org.springframework.boot.logging.LoggingApplicationListener; //导入依赖的package包/类
public static void main(String[] args) {
SpringApplicationBuilder builder = new SpringApplicationBuilder(Launcher.class);
Set<ApplicationListener<?>> listeners = builder.application().getListeners();
for (Iterator<ApplicationListener<?>> it = listeners.iterator(); it.hasNext();) {
ApplicationListener<?> listener = it.next();
if (listener instanceof LoggingApplicationListener) {
it.remove();
}
}
builder.application().setListeners(listeners);
ConfigurableApplicationContext context = builder.run(args);
LOGGER.info("collector trace start successfully");
KafkaConsumer kafkaConsumer = (KafkaConsumer<byte[], String>) context.getBean("kafkaConsumer");
Task task = (Task) context.getBean("rpcTraceTask");
// 优雅停止项目
Runtime.getRuntime().addShutdownHook(new ShutdownHookRunner(kafkaConsumer, task));
task.doTask();
}
示例4: main
import org.springframework.boot.logging.LoggingApplicationListener; //导入依赖的package包/类
public static void main(String[] args) {
SpringApplicationBuilder builder = new SpringApplicationBuilder(Launcher.class);
Set<ApplicationListener<?>> listeners = builder.application().getListeners();
for (Iterator<ApplicationListener<?>> it = listeners.iterator(); it.hasNext();) {
ApplicationListener<?> listener = it.next();
if (listener instanceof LoggingApplicationListener) {
it.remove();
}
}
builder.application().setListeners(listeners);
ConfigurableApplicationContext context = builder.run(args);
LOGGER.info("collector indexer start successfully");
KafkaConsumer kafkaConsumer = (KafkaConsumer<byte[], String>) context.getBean("kafkaConsumer");
Task task = (Task) context.getBean("indexerTask");
// 优雅停止项目
Runtime.getRuntime().addShutdownHook(new ShutdownHookRunner(kafkaConsumer, task));
task.doTask();
}
示例5: main
import org.springframework.boot.logging.LoggingApplicationListener; //导入依赖的package包/类
public static void main(String[] args) {
SpringApplicationBuilder builder = new SpringApplicationBuilder(Launcher.class);
Set<ApplicationListener<?>> listeners = builder.application().getListeners();
for (Iterator<ApplicationListener<?>> it = listeners.iterator(); it.hasNext();) {
ApplicationListener<?> listener = it.next();
if (listener instanceof LoggingApplicationListener) {
it.remove();
}
}
builder.application().setListeners(listeners);
ConfigurableApplicationContext context = builder.run(args);
LOGGER.info("collector metrics start successfully");
KafkaConsumer kafkaConsumer = (KafkaConsumer<byte[], String>) context.getBean("kafkaConsumer");
Task task = (Task) context.getBean("metricsTask");
// 优雅停止项目
Runtime.getRuntime().addShutdownHook(new ShutdownHookRunner(kafkaConsumer, task));
task.doTask();
}
示例6: main
import org.springframework.boot.logging.LoggingApplicationListener; //导入依赖的package包/类
public static void main(String[] args) {
SpringApplicationBuilder builder = new SpringApplicationBuilder(Launcher.class);
Set<ApplicationListener<?>> listeners = builder.application().getListeners();
for (Iterator<ApplicationListener<?>> it = listeners.iterator(); it.hasNext();) {
ApplicationListener<?> listener = it.next();
if (listener instanceof LoggingApplicationListener) {
it.remove();
}
}
builder.application().setListeners(listeners);
builder.run(args);
LOGGER.info("服务C start successfully");
// 优雅停止项目
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
LOGGER.info("try to stop the system");
synchronized (Launcher.class) {
RUNNING = false;
Launcher.class.notify();
}
}
});
synchronized (Launcher.class) {
while (RUNNING) {
try {
Launcher.class.wait();
} catch (InterruptedException e) {
LOGGER.error("wait error");
e.printStackTrace();
}
}
}
}
示例7: main
import org.springframework.boot.logging.LoggingApplicationListener; //导入依赖的package包/类
public static void main(String[] args) {
SpringApplicationBuilder builder = new SpringApplicationBuilder(Launcher.class);
Set<ApplicationListener<?>> listeners = builder.application().getListeners();
for (Iterator<ApplicationListener<?>> it = listeners.iterator(); it.hasNext();) {
ApplicationListener<?> listener = it.next();
if (listener instanceof LoggingApplicationListener) {
it.remove();
}
}
builder.application().setListeners(listeners);
builder.run(args);
LOGGER.info("服务B start successfully");
// 优雅停止项目
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
LOGGER.info("try to stop the system");
synchronized (Launcher.class) {
RUNNING = false;
Launcher.class.notify();
}
}
});
synchronized (Launcher.class) {
while (RUNNING) {
try {
Launcher.class.wait();
} catch (InterruptedException e) {
LOGGER.error("wait error");
e.printStackTrace();
}
}
}
}
示例8: main
import org.springframework.boot.logging.LoggingApplicationListener; //导入依赖的package包/类
public static void main(String[] args) {
SpringApplicationBuilder builder = new SpringApplicationBuilder(Launcher.class);
Set<ApplicationListener<?>> listeners = builder.application().getListeners();
for (Iterator<ApplicationListener<?>> it = listeners.iterator(); it.hasNext();) {
ApplicationListener<?> listener = it.next();
if (listener instanceof LoggingApplicationListener) {
it.remove();
}
}
builder.application().setListeners(listeners);
builder.run(args);
LOGGER.info("服务E start successfully");
// 优雅停止项目
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
LOGGER.info("try to stop the system");
synchronized (Launcher.class) {
RUNNING = false;
Launcher.class.notify();
}
}
});
synchronized (Launcher.class) {
while (RUNNING) {
try {
Launcher.class.wait();
} catch (InterruptedException e) {
LOGGER.error("wait error");
e.printStackTrace();
}
}
}
}
示例9: main
import org.springframework.boot.logging.LoggingApplicationListener; //导入依赖的package包/类
public static void main(String[] args) {
SpringApplicationBuilder builder = new SpringApplicationBuilder(Launcher.class);
Set<ApplicationListener<?>> listeners = builder.application().getListeners();
for (Iterator<ApplicationListener<?>> it = listeners.iterator(); it.hasNext();) {
ApplicationListener<?> listener = it.next();
if (listener instanceof LoggingApplicationListener) {
it.remove();
}
}
builder.application().setListeners(listeners);
builder.run(args);
LOGGER.info("服务D start successfully");
// 优雅停止项目
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
LOGGER.info("try to stop the system");
synchronized (Launcher.class) {
RUNNING = false;
Launcher.class.notify();
}
}
});
synchronized (Launcher.class) {
while (RUNNING) {
try {
Launcher.class.wait();
} catch (InterruptedException e) {
LOGGER.error("wait error");
e.printStackTrace();
}
}
}
}
示例10: main
import org.springframework.boot.logging.LoggingApplicationListener; //导入依赖的package包/类
public static void main(String[] args) {
SpringApplicationBuilder builder = new SpringApplicationBuilder(Application.class);
Set<ApplicationListener<?>> listeners = builder.application().getListeners();
for (Iterator<ApplicationListener<?>> it = listeners.iterator(); it.hasNext();) {
ApplicationListener<?> listener = it.next();
if (listener instanceof LoggingApplicationListener) {
it.remove();
}
}
builder.application().setListeners(listeners);
builder.run(args);
LOGGER.info("接口A start successfully");
}
示例11: main
import org.springframework.boot.logging.LoggingApplicationListener; //导入依赖的package包/类
public static void main(String[] args) {
SpringApplicationBuilder builder = new SpringApplicationBuilder(Launcher.class);
Set<ApplicationListener<?>> listeners = builder.application().getListeners();
for (Iterator<ApplicationListener<?>> it = listeners.iterator(); it.hasNext();) {
ApplicationListener<?> listener = it.next();
if (listener instanceof LoggingApplicationListener) {
it.remove();
}
}
builder.application().setListeners(listeners);
builder.run(args);
LOGGER.info("alarm start successfully");
// 优雅停止项目
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
LOGGER.info("try to stop the system");
synchronized (Launcher.class) {
RUNNING = false;
Launcher.class.notify();
}
}
});
synchronized (Launcher.class) {
while (RUNNING) {
try {
Launcher.class.wait();
} catch (InterruptedException e) {
LOGGER.error("wait error");
e.printStackTrace();
}
}
}
}
示例12: main
import org.springframework.boot.logging.LoggingApplicationListener; //导入依赖的package包/类
public static void main(String[] args) {
SpringApplicationBuilder builder = new SpringApplicationBuilder(Application.class);
Set<ApplicationListener<?>> listeners = builder.application().getListeners();
for (Iterator<ApplicationListener<?>> it = listeners.iterator(); it.hasNext();) {
ApplicationListener<?> listener = it.next();
if (listener instanceof LoggingApplicationListener) {
it.remove();
}
}
builder.application().setListeners(listeners);
builder.run(args);
LOGGER.info("web start successfully");
}
示例13: main
import org.springframework.boot.logging.LoggingApplicationListener; //导入依赖的package包/类
public static void main(String[] args) {
SpringApplicationBuilder builder = new SpringApplicationBuilder(Launcher.class);
Set<ApplicationListener<?>> listeners = builder.application().getListeners();
for (Iterator<ApplicationListener<?>> it = listeners.iterator(); it.hasNext();) {
ApplicationListener<?> listener = it.next();
if (listener instanceof LoggingApplicationListener) {
it.remove();
}
}
builder.application().setListeners(listeners);
builder.run(args);
LOGGER.info("monitor start successfully");
// 优雅停止项目
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
LOGGER.info("try to stop the system");
synchronized (Launcher.class) {
RUNNING = false;
Launcher.class.notify();
}
}
});
synchronized (Launcher.class) {
while (RUNNING) {
try {
Launcher.class.wait();
} catch (InterruptedException e) {
LOGGER.error("wait error");
e.printStackTrace();
}
}
}
}
示例14: getListeners
import org.springframework.boot.logging.LoggingApplicationListener; //导入依赖的package包/类
private Collection<ApplicationListener<?>> getListeners() {
List<ApplicationListener<?>> listeners = new ArrayList<ApplicationListener<?>>();
listeners.add(new AnsiOutputApplicationListener());
listeners.add(new ConfigFileApplicationListener());
listeners.add(new ClasspathLoggingApplicationListener());
listeners.add(new LoggingApplicationListener());
listeners.add(new RemoteUrlPropertyExtractor());
return listeners;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:10,代码来源:RemoteSpringApplication.java
示例15: getListeners
import org.springframework.boot.logging.LoggingApplicationListener; //导入依赖的package包/类
private Collection<ApplicationListener<?>> getListeners() {
List<ApplicationListener<?>> listeners = new ArrayList<ApplicationListener<?>>();
listeners.add(new AnsiOutputApplicationListener());
listeners.add(new ConfigFileEnvironmentPostProcessor());
listeners.add(new EnvironmentPostProcessingApplicationListener());
listeners.add(new ClasspathLoggingApplicationListener());
listeners.add(new LoggingApplicationListener());
listeners.add(new RemoteUrlPropertyExtractor());
return listeners;
}