org.springframework.boot.logging.LoggingApplicationListener Java Examples
The following examples show how to use
org.springframework.boot.logging.LoggingApplicationListener.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Launcher.java From SkyEye with GNU General Public License v3.0 | 6 votes |
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); } }
Example #2
Source File: Launcher.java From SkyEye with GNU General Public License v3.0 | 6 votes |
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(); }
Example #3
Source File: Launcher.java From SkyEye with GNU General Public License v3.0 | 6 votes |
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(); }
Example #4
Source File: Launcher.java From SkyEye with GNU General Public License v3.0 | 6 votes |
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(); }
Example #5
Source File: Launcher.java From SkyEye with GNU General Public License v3.0 | 6 votes |
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(); }
Example #6
Source File: Launcher.java From SkyEye with GNU General Public License v3.0 | 5 votes |
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(); } } } }
Example #7
Source File: Launcher.java From SkyEye with GNU General Public License v3.0 | 5 votes |
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(); } } } }
Example #8
Source File: Launcher.java From SkyEye with GNU General Public License v3.0 | 5 votes |
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(); } } } }
Example #9
Source File: Launcher.java From SkyEye with GNU General Public License v3.0 | 5 votes |
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(); } } } }
Example #10
Source File: Application.java From SkyEye with GNU General Public License v3.0 | 5 votes |
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"); }
Example #11
Source File: Launcher.java From SkyEye with GNU General Public License v3.0 | 5 votes |
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(); } } } }
Example #12
Source File: Application.java From SkyEye with GNU General Public License v3.0 | 5 votes |
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"); }
Example #13
Source File: Launcher.java From SkyEye with GNU General Public License v3.0 | 5 votes |
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(); } } } }
Example #14
Source File: Launcher.java From SkyEye with GNU General Public License v3.0 | 4 votes |
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("log-generator start successfully"); GenerateLogService logService = context.getBean(GenerateLogService.class); logService.generateCoverLog(); // 优雅停止项目 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(); } } } }