Java Code Examples for org.springframework.boot.context.logging.LoggingApplicationListener

The following examples show how to use org.springframework.boot.context.logging.LoggingApplicationListener. These examples are extracted from open source projects. 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 Project: mPaaS   Source File: LogbackListener.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void environmentPrepared(ConfigurableEnvironment environment) {
    if (executed.compareAndSet(false, true)) {
        String logConfig = environment.getProperty(LoggingApplicationListener.CONFIG_PROPERTY);
        if (StringUtils.isEmpty(logConfig)) {
            URL url = LogbackListener.class.getResource(LOGBACK_CFG_NAME);
            String filePath = url.getPath();
            if (filePath.indexOf(ResourceUtils.JAR_FILE_EXTENSION) > -1) {
                filePath = ResourceUtils.JAR_URL_PREFIX + filePath;
            }
            System.setProperty(LoggingApplicationListener.CONFIG_PROPERTY, filePath);
        }
    }
}
 
Example 2
Source Project: mPass   Source File: LogbackListener.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void environmentPrepared(ConfigurableEnvironment environment) {
    if (executed.compareAndSet(false, true)) {
        String logConfig = environment.getProperty(LoggingApplicationListener.CONFIG_PROPERTY);
        if (StringUtils.isEmpty(logConfig)) {
            URL url = LogbackListener.class.getResource(LOGBACK_CFG_NAME);
            String filePath = url.getPath();
            if (filePath.indexOf(ResourceUtils.JAR_FILE_EXTENSION) > -1) {
                filePath = ResourceUtils.JAR_URL_PREFIX + filePath;
            }
            System.setProperty(LoggingApplicationListener.CONFIG_PROPERTY, filePath);
        }
    }
}
 
Example 3
@Override
public int getOrder() {

	return LoggingApplicationListener.DEFAULT_ORDER > Ordered.HIGHEST_PRECEDENCE
		? LoggingApplicationListener.DEFAULT_ORDER - 1
		: Ordered.HIGHEST_PRECEDENCE;
}
 
Example 4
private Collection<? extends ApplicationListener<?>> filterListeners(
		Set<ApplicationListener<?>> listeners) {
	Set<ApplicationListener<?>> result = new LinkedHashSet<>();
	for (ApplicationListener<?> listener : listeners) {
		if (!(listener instanceof LoggingApplicationListener)
				&& !(listener instanceof LoggingSystemShutdownListener)) {
			result.add(listener);
		}
	}
	return result;
}
 
Example 5
@Override
public int getOrder() {
    return LoggingApplicationListener.DEFAULT_ORDER - 1;
}
 
Example 6
@Override
public int getOrder() {
    return LoggingApplicationListener.DEFAULT_ORDER - 1;
}
 
Example 7
@Test
public void getOrderReturnsHigherPrecedenceThanSpringBootLoggingApplicationListenerOrderByDefault() {
	assertThat(this.listener.getOrder()).isLessThan(new LoggingApplicationListener().getOrder());
}