Commit 30d76a73 by Johannes Edmeier

Add logging statements

parent ebd94f0c
...@@ -84,6 +84,8 @@ public class ApplicationDiscoveryListener { ...@@ -84,6 +84,8 @@ public class ApplicationDiscoveryListener {
String applicationId = register(instance); String applicationId = register(instance);
staleApplicationIds.remove(applicationId); staleApplicationIds.remove(applicationId);
} }
} else {
LOGGER.debug("Ignoring discovered service {}", serviceId);
} }
} }
for (String staleApplicationId : staleApplicationIds) { for (String staleApplicationId : staleApplicationIds) {
...@@ -107,6 +109,7 @@ public class ApplicationDiscoveryListener { ...@@ -107,6 +109,7 @@ public class ApplicationDiscoveryListener {
try { try {
Application application = converter.convert(instance); Application application = converter.convert(instance);
if (application != null) { if (application != null) {
LOGGER.debug("Registering discovered application {}", application);
return registry.register(application).getId(); return registry.register(application).getId();
} else { } else {
LOGGER.warn("No application for service {} registered", instance); LOGGER.warn("No application for service {} registered", instance);
......
...@@ -20,6 +20,8 @@ import static org.apache.commons.lang.StringUtils.stripStart; ...@@ -20,6 +20,8 @@ import static org.apache.commons.lang.StringUtils.stripStart;
import java.net.URI; import java.net.URI;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.client.ServiceInstance; import org.springframework.cloud.client.ServiceInstance;
import org.springframework.web.util.UriComponentsBuilder; import org.springframework.web.util.UriComponentsBuilder;
...@@ -35,6 +37,8 @@ import de.codecentric.boot.admin.model.Application; ...@@ -35,6 +37,8 @@ import de.codecentric.boot.admin.model.Application;
* @author Johannes Edmeier * @author Johannes Edmeier
*/ */
public class DefaultServiceInstanceConverter implements ServiceInstanceConverter { public class DefaultServiceInstanceConverter implements ServiceInstanceConverter {
private static final Logger LOGGER = LoggerFactory
.getLogger(DefaultServiceInstanceConverter.class);
private static final String KEY_MANAGEMENT_PORT = "management.port"; private static final String KEY_MANAGEMENT_PORT = "management.port";
private static final String KEY_MANAGEMENT_PATH = "management.context-path"; private static final String KEY_MANAGEMENT_PATH = "management.context-path";
private static final String KEY_HEALTH_PATH = "health.path"; private static final String KEY_HEALTH_PATH = "health.path";
...@@ -43,6 +47,10 @@ public class DefaultServiceInstanceConverter implements ServiceInstanceConverter ...@@ -43,6 +47,10 @@ public class DefaultServiceInstanceConverter implements ServiceInstanceConverter
@Override @Override
public Application convert(ServiceInstance instance) { public Application convert(ServiceInstance instance) {
LOGGER.debug("Converting service '{}' running at '{}' with metadata {}",
instance.getServiceId(),
instance.getUri(), instance.getMetadata());
Application.Builder builder = Application.create(instance.getServiceId()); Application.Builder builder = Application.create(instance.getServiceId());
URI healthUrl = getHealthUrl(instance); URI healthUrl = getHealthUrl(instance);
if (healthUrl != null) { if (healthUrl != null) {
......
...@@ -51,6 +51,9 @@ public class ConcatenatingResourceResolver extends AbstractResourceResolver { ...@@ -51,6 +51,9 @@ public class ConcatenatingResourceResolver extends AbstractResourceResolver {
List<? extends Resource> locations, ResourceResolverChain chain) { List<? extends Resource> locations, ResourceResolverChain chain) {
String filename = StringUtils.getFilename(requestPath); String filename = StringUtils.getFilename(requestPath);
try { try {
if (logger.isDebugEnabled()) {
logger.debug("Creating concatenated resource '" + filename + "' from " + locations);
}
return new InMemoryFileResource(filename, buildDescription(locations), return new InMemoryFileResource(filename, buildDescription(locations),
getContent(locations), getLastModified(locations)); getContent(locations), getLastModified(locations));
} catch (IOException ex) { } catch (IOException ex) {
......
...@@ -33,7 +33,6 @@ import org.springframework.web.servlet.resource.ResourceResolverChain; ...@@ -33,7 +33,6 @@ import org.springframework.web.servlet.resource.ResourceResolverChain;
* @author Johannes Edmeier * @author Johannes Edmeier
*/ */
public class PreferMinifiedFilteringResourceResolver extends AbstractResourceResolver { public class PreferMinifiedFilteringResourceResolver extends AbstractResourceResolver {
private final String extensionPrefix; private final String extensionPrefix;
public PreferMinifiedFilteringResourceResolver(String extensionPrefix) { public PreferMinifiedFilteringResourceResolver(String extensionPrefix) {
...@@ -43,7 +42,7 @@ public class PreferMinifiedFilteringResourceResolver extends AbstractResourceRes ...@@ -43,7 +42,7 @@ public class PreferMinifiedFilteringResourceResolver extends AbstractResourceRes
@Override @Override
protected Resource resolveResourceInternal(HttpServletRequest request, String requestPath, protected Resource resolveResourceInternal(HttpServletRequest request, String requestPath,
List<? extends Resource> locations, ResourceResolverChain chain) { List<? extends Resource> locations, ResourceResolverChain chain) {
List<Resource> newLocations = new ArrayList<Resource>(locations.size()); List<Resource> newLocations = new ArrayList<>(locations.size());
for (Resource location : locations) { for (Resource location : locations) {
Resource minified = findMinified(location); Resource minified = findMinified(location);
...@@ -60,6 +59,10 @@ public class PreferMinifiedFilteringResourceResolver extends AbstractResourceRes ...@@ -60,6 +59,10 @@ public class PreferMinifiedFilteringResourceResolver extends AbstractResourceRes
Resource minified = resource Resource minified = resource
.createRelative(basename + extensionPrefix + '.' + extension); .createRelative(basename + extensionPrefix + '.' + extension);
if (minified.exists()) { if (minified.exists()) {
if (logger.isDebugEnabled()) {
logger.debug("Found minified file for '" + resource.getFilename() + "': '"
+ minified.getFilename() + "'");
}
return minified; return minified;
} }
} catch (IOException ex) { } catch (IOException ex) {
......
...@@ -50,6 +50,10 @@ public class ResourcePatternResolvingResourceResolver extends AbstractResourceRe ...@@ -50,6 +50,10 @@ public class ResourcePatternResolvingResourceResolver extends AbstractResourceRe
List<? extends Resource> locations, ResourceResolverChain chain) { List<? extends Resource> locations, ResourceResolverChain chain) {
try { try {
Resource[] resources = resourcePatternResolver.getResources(pattern); Resource[] resources = resourcePatternResolver.getResources(pattern);
if (logger.isDebugEnabled()) {
logger.debug(
"Resolved Resources for '" + pattern + "': " + Arrays.toString(resources));
}
return chain.resolveResource(request, requestPath, Arrays.asList(resources)); return chain.resolveResource(request, requestPath, Arrays.asList(resources));
} catch (IOException ex) { } catch (IOException ex) {
throw new ResourceAccessException("Couldn't resolve resources for \"" + pattern + "\"", throw new ResourceAccessException("Couldn't resolve resources for \"" + pattern + "\"",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment