Fix logging checkstye violations in samples

See gh-14911
pull/14969/head
Phillip Webb 6 years ago
parent b424fa6039
commit 5a4220c773

@ -19,6 +19,8 @@ package sample.atmosphere;
import java.io.IOException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.atmosphere.config.managed.Decoder;
import org.atmosphere.config.managed.Encoder;
import org.atmosphere.config.service.Disconnect;
@ -26,29 +28,27 @@ import org.atmosphere.config.service.ManagedService;
import org.atmosphere.config.service.Ready;
import org.atmosphere.cpr.AtmosphereResource;
import org.atmosphere.cpr.AtmosphereResourceEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ManagedService(path = "/chat")
public class ChatService {
private final Logger logger = LoggerFactory.getLogger(ChatService.class);
private final Log logger = LogFactory.getLog(ChatService.class);
@Ready
public void onReady(AtmosphereResource resource) {
this.logger.info("Connected", resource.uuid());
this.logger.info("Connected " + resource.uuid());
}
@Disconnect
public void onDisconnect(AtmosphereResourceEvent event) {
this.logger.info("Client {} disconnected [{}]", event.getResource().uuid(),
event.isCancelled() ? "cancelled" : "closed");
this.logger.info("Client " + event.getResource().uuid() + " disconnected ["
+ (event.isCancelled() ? "cancelled" : "closed") + "]");
}
@org.atmosphere.config.service.Message(encoders = JacksonEncoderDecoder.class, decoders = JacksonEncoderDecoder.class)
public Message onMessage(Message message) throws IOException {
this.logger.info("Author {} sent message {}", message.getAuthor(),
message.getMessage());
this.logger.info("Author " + message.getAuthor() + " sent message "
+ message.getMessage());
return message;
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -16,8 +16,8 @@
package sample.cache;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.cache.CacheManager;
@ -26,7 +26,7 @@ import org.springframework.stereotype.Component;
@Component
public class CacheManagerCheck implements CommandLineRunner {
private static final Logger logger = LoggerFactory.getLogger(CacheManagerCheck.class);
private static final Log logger = LogFactory.getLog(CacheManagerCheck.class);
private final CacheManager cacheManager;

@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -16,17 +16,17 @@
package sample.data.cassandra;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.cassandraunit.spring.CassandraUnitDependencyInjectionTestExecutionListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.Ordered;
public class OrderedCassandraTestExecutionListener
extends CassandraUnitDependencyInjectionTestExecutionListener {
private static final Logger logger = LoggerFactory
.getLogger(OrderedCassandraTestExecutionListener.class);
private static final Log logger = LogFactory
.getLog(OrderedCassandraTestExecutionListener.class);
@Override
public int getOrder() {

@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -16,8 +16,8 @@
package sample.test.service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import sample.test.domain.VehicleIdentificationNumber;
import org.springframework.boot.web.client.RestTemplateBuilder;
@ -35,8 +35,8 @@ import org.springframework.web.client.RestTemplate;
@Service
public class RemoteVehicleDetailsService implements VehicleDetailsService {
private static final Logger logger = LoggerFactory
.getLogger(RemoteVehicleDetailsService.class);
private static final Log logger = LogFactory
.getLog(RemoteVehicleDetailsService.class);
private final RestTemplate restTemplate;

@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -18,20 +18,20 @@ package sample.webservices.service;
import java.util.Date;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Service;
@Service
public class StubHumanResourceService implements HumanResourceService {
private final Logger logger = LoggerFactory.getLogger(StubHumanResourceService.class);
private final Log logger = LogFactory.getLog(StubHumanResourceService.class);
@Override
public void bookHoliday(Date startDate, Date endDate, String name) {
this.logger.info("Booking holiday for [{} - {}] for [{}] ", startDate, endDate,
name);
this.logger.info("Booking holiday for [" + startDate + " - " + endDate + "] for ["
+ name + "]");
}
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -16,8 +16,8 @@
package samples.websocket.jetty.echo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.socket.CloseStatus;
import org.springframework.web.socket.TextMessage;
@ -30,7 +30,7 @@ import org.springframework.web.socket.handler.TextWebSocketHandler;
*/
public class EchoWebSocketHandler extends TextWebSocketHandler {
private static Logger logger = LoggerFactory.getLogger(EchoWebSocketHandler.class);
private static Log logger = LogFactory.getLog(EchoWebSocketHandler.class);
private final EchoService echoService;

@ -24,8 +24,8 @@ import java.util.TimerTask;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Sets up the timer for the multi-player snake game WebSocket example.
@ -36,7 +36,7 @@ public final class SnakeTimer {
private static final Object MONITOR = new Object();
private static final Logger log = LoggerFactory.getLogger(SnakeTimer.class);
private static final Log logger = LogFactory.getLog(SnakeTimer.class);
private static final ConcurrentHashMap<Integer, Snake> snakes = new ConcurrentHashMap<>();
@ -103,7 +103,7 @@ public final class SnakeTimer {
tick();
}
catch (Throwable ex) {
log.error("Caught to prevent timer from shutting down", ex);
logger.error("Caught to prevent timer from shutting down", ex);
}
}
}, TICK_DELAY, TICK_DELAY);

@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -16,8 +16,8 @@
package samples.websocket.tomcat.echo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.socket.CloseStatus;
import org.springframework.web.socket.TextMessage;
@ -30,7 +30,7 @@ import org.springframework.web.socket.handler.TextWebSocketHandler;
*/
public class EchoWebSocketHandler extends TextWebSocketHandler {
private static Logger logger = LoggerFactory.getLogger(EchoWebSocketHandler.class);
private static Log logger = LogFactory.getLog(EchoWebSocketHandler.class);
private final EchoService echoService;

@ -24,8 +24,8 @@ import java.util.TimerTask;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Sets up the timer for the multi-player snake game WebSocket example.
@ -36,7 +36,7 @@ public final class SnakeTimer {
private static final Object MONITOR = new Object();
private static final Logger log = LoggerFactory.getLogger(SnakeTimer.class);
private static final Log logger = LogFactory.getLog(SnakeTimer.class);
private static final ConcurrentHashMap<Integer, Snake> snakes = new ConcurrentHashMap<>();
@ -103,7 +103,7 @@ public final class SnakeTimer {
tick();
}
catch (Throwable ex) {
log.error("Caught to prevent timer from shutting down", ex);
logger.error("Caught to prevent timer from shutting down", ex);
}
}
}, TICK_DELAY, TICK_DELAY);

@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -16,8 +16,8 @@
package samples.websocket.undertow.echo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.socket.CloseStatus;
import org.springframework.web.socket.TextMessage;
@ -30,7 +30,7 @@ import org.springframework.web.socket.handler.TextWebSocketHandler;
*/
public class EchoWebSocketHandler extends TextWebSocketHandler {
private static Logger logger = LoggerFactory.getLogger(EchoWebSocketHandler.class);
private static Log logger = LogFactory.getLog(EchoWebSocketHandler.class);
private final EchoService echoService;

@ -24,8 +24,8 @@ import java.util.TimerTask;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Sets up the timer for the multi-player snake game WebSocket example.
@ -36,7 +36,7 @@ public final class SnakeTimer {
private static final Object MONITOR = new Object();
private static final Logger log = LoggerFactory.getLogger(SnakeTimer.class);
private static final Log logger = LogFactory.getLog(SnakeTimer.class);
private static final ConcurrentHashMap<Integer, Snake> snakes = new ConcurrentHashMap<>();
@ -103,7 +103,7 @@ public final class SnakeTimer {
tick();
}
catch (Throwable ex) {
log.error("Caught to prevent timer from shutting down", ex);
logger.error("Caught to prevent timer from shutting down", ex);
}
}
}, TICK_DELAY, TICK_DELAY);

@ -34,4 +34,5 @@
<suppress files="EmbeddedMongoAutoConfiguration\.java" checks="IllegalImport" />
<suppress files="LogbackMetricsAutoConfiguration\.java" checks="IllegalImport" />
<suppress files="RemoteUrlPropertyExtractorTests\.java" checks="IllegalImport" />
<suppress files="SampleLogbackApplication\.java" checks="IllegalImport" />
</suppressions>

Loading…
Cancel
Save