当前位置: 首页>>代码示例>>Java>>正文


Java LoggingApplicationListener类代码示例

本文整理汇总了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();
}
 
开发者ID:JThink,项目名称:SkyEye,代码行数:21,代码来源:Launcher.java

示例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);
    }
}
 
开发者ID:JThink,项目名称:SkyEye,代码行数:21,代码来源:Launcher.java

示例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();
}
 
开发者ID:JThink,项目名称:SkyEye,代码行数:21,代码来源:Launcher.java

示例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();
}
 
开发者ID:JThink,项目名称:SkyEye,代码行数:21,代码来源:Launcher.java

示例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();
}
 
开发者ID:JThink,项目名称:SkyEye,代码行数:21,代码来源:Launcher.java

示例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();
            }
        }
    }
}
 
开发者ID:JThink,项目名称:SkyEye,代码行数:38,代码来源:Launcher.java

示例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();
            }
        }
    }
}
 
开发者ID:JThink,项目名称:SkyEye,代码行数:38,代码来源:Launcher.java

示例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();
            }
        }
    }
}
 
开发者ID:JThink,项目名称:SkyEye,代码行数:38,代码来源:Launcher.java

示例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();
            }
        }
    }
}
 
开发者ID:JThink,项目名称:SkyEye,代码行数:38,代码来源:Launcher.java

示例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");
}
 
开发者ID:JThink,项目名称:SkyEye,代码行数:15,代码来源:Application.java

示例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();
            }
        }
    }
}
 
开发者ID:JThink,项目名称:SkyEye,代码行数:37,代码来源:Launcher.java

示例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");
}
 
开发者ID:JThink,项目名称:SkyEye,代码行数:15,代码来源:Application.java

示例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();
            }
        }
    }
}
 
开发者ID:JThink,项目名称:SkyEye,代码行数:37,代码来源:Launcher.java

示例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;
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:11,代码来源:RemoteSpringApplication.java


注:本文中的org.springframework.boot.logging.LoggingApplicationListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。