Skip to content

Commit c9fb2e1

Browse files
committedApr 15, 2020
Applied Logging for configLocation controller with logback.xml file
1 parent 7ca7194 commit c9fb2e1

File tree

4 files changed

+133
-17
lines changed

4 files changed

+133
-17
lines changed
 

‎.idea/workspace.xml

+14-17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎logs/movie-catalog-service.log

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
18:06:15.323 [main] INFO o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$b112bed1] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2+
18:06:15.733 [main] INFO o.s.c.c.c.ConfigServicePropertySourceLocator - Fetching config from server at : http://localhost:8888
3+
18:06:15.875 [main] INFO o.s.c.c.c.ConfigServicePropertySourceLocator - Connect Timeout Exception on Url - http://localhost:8888. Will be trying the next url if available
4+
18:06:15.876 [main] WARN o.s.c.c.c.ConfigServicePropertySourceLocator - Could not locate PropertySource: I/O error on GET request for "http://localhost:8888/movie-catalog-service/default": Connection refused (Connection refused); nested exception is java.net.ConnectException: Connection refused (Connection refused)
5+
18:06:15.883 [main] INFO i.j.m.MovieCatalogServiceApplication - No active profile set, falling back to default profiles: default
6+
18:06:17.328 [main] WARN o.s.boot.actuate.endpoint.EndpointId - Endpoint ID 'service-registry' contains invalid characters, please migrate to a valid format.
7+
18:06:17.349 [main] WARN o.s.boot.actuate.endpoint.EndpointId - Endpoint ID 'hystrix.stream' contains invalid characters, please migrate to a valid format.
8+
18:06:17.755 [main] INFO o.s.cloud.context.scope.GenericScope - BeanFactory id=a29a804a-64ce-3a48-8d44-4d581e457524
9+
18:06:18.177 [main] INFO o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$b112bed1] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
10+
18:06:18.900 [main] INFO o.s.b.w.e.tomcat.TomcatWebServer - Tomcat initialized with port(s): 8081 (http)
11+
18:06:18.926 [main] INFO o.a.coyote.http11.Http11NioProtocol - Initializing ProtocolHandler ["http-nio-8081"]
12+
18:06:18.950 [main] INFO o.a.catalina.core.StandardService - Starting service [Tomcat]
13+
18:06:18.951 [main] INFO o.a.catalina.core.StandardEngine - Starting Servlet engine: [Apache Tomcat/9.0.14]
14+
18:06:18.968 [main] INFO o.a.c.core.AprLifecycleListener - The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib]
15+
18:06:19.533 [main] INFO o.a.c.c.C.[Tomcat].[localhost].[/] - Initializing Spring embedded WebApplicationContext
16+
18:06:19.534 [main] INFO o.s.web.context.ContextLoader - Root WebApplicationContext: initialization completed in 3587 ms
17+
18:06:19.850 [main] WARN c.n.c.sources.URLConfigurationSource - No URLs will be polled as dynamic configuration sources.
18+
18:06:19.851 [main] INFO c.n.c.sources.URLConfigurationSource - To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
19+
18:06:19.889 [main] INFO c.n.config.DynamicPropertyFactory - DynamicPropertyFactory is initialized with configuration sources: com.netflix.config.ConcurrentCompositeConfiguration@49e7e8f1
20+
18:06:20.834 [main] INFO o.s.b.a.e.w.ServletEndpointRegistrar - Registered '/actuator/hystrix.stream' to hystrix.stream-actuator-endpoint
21+
18:06:21.713 [main] WARN c.n.c.sources.URLConfigurationSource - No URLs will be polled as dynamic configuration sources.
22+
18:06:21.713 [main] INFO c.n.c.sources.URLConfigurationSource - To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
23+
18:06:22.182 [main] INFO o.s.s.c.ThreadPoolTaskExecutor - Initializing ExecutorService 'applicationTaskExecutor'
24+
18:06:23.125 [main] INFO o.s.b.a.e.web.EndpointLinksResolver - Exposing 20 endpoint(s) beneath base path '/actuator'
25+
18:06:23.272 [main] INFO o.s.c.n.eureka.InstanceInfoFactory - Setting initial instance status as: STARTING
26+
18:06:23.323 [main] INFO c.netflix.discovery.DiscoveryClient - Initializing Eureka in region us-east-1
27+
18:06:23.388 [main] INFO c.n.d.p.DiscoveryJerseyProvider - Using JSON encoding codec LegacyJacksonJson
28+
18:06:23.389 [main] INFO c.n.d.p.DiscoveryJerseyProvider - Using JSON decoding codec LegacyJacksonJson
29+
18:06:23.623 [main] INFO c.n.d.p.DiscoveryJerseyProvider - Using XML encoding codec XStreamXml
30+
18:06:23.623 [main] INFO c.n.d.p.DiscoveryJerseyProvider - Using XML decoding codec XStreamXml
31+
18:06:23.819 [main] INFO c.n.d.s.r.aws.ConfigClusterResolver - Resolving eureka endpoints via configuration
32+
18:06:23.854 [main] INFO c.netflix.discovery.DiscoveryClient - Disable delta property : false
33+
18:06:23.855 [main] INFO c.netflix.discovery.DiscoveryClient - Single vip registry refresh property : null
34+
18:06:23.855 [main] INFO c.netflix.discovery.DiscoveryClient - Force full registry fetch : false
35+
18:06:23.855 [main] INFO c.netflix.discovery.DiscoveryClient - Application is null : false
36+
18:06:23.855 [main] INFO c.netflix.discovery.DiscoveryClient - Registered Applications size is zero : true
37+
18:06:23.855 [main] INFO c.netflix.discovery.DiscoveryClient - Application version is -1: true
38+
18:06:23.856 [main] INFO c.netflix.discovery.DiscoveryClient - Getting all instance registry info from the eureka server
39+
18:06:23.964 [main] INFO c.netflix.discovery.DiscoveryClient - The response status is 200
40+
18:06:23.967 [main] INFO c.netflix.discovery.DiscoveryClient - Starting heartbeat executor: renew interval is: 30
41+
18:06:23.972 [main] INFO c.n.discovery.InstanceInfoReplicator - InstanceInfoReplicator onDemand update allowed rate per min is 4
42+
18:06:23.978 [main] INFO c.netflix.discovery.DiscoveryClient - Discovery Client initialized at timestamp 1586954183976 with initial instances count: 0
43+
18:06:23.983 [main] INFO o.s.c.n.e.s.EurekaServiceRegistry - Registering application MOVIE-CATALOG-SERVICE with eureka with status UP
44+
18:06:23.984 [main] INFO c.netflix.discovery.DiscoveryClient - Saw local status change event StatusChangeEvent [timestamp=1586954183984, current=UP, previous=STARTING]
45+
18:06:23.987 [DiscoveryClient-InstanceInfoReplicator-0] INFO c.netflix.discovery.DiscoveryClient - DiscoveryClient_MOVIE-CATALOG-SERVICE/192.168.1.7:movie-catalog-service:8081: registering service...
46+
18:06:24.021 [main] INFO o.a.coyote.http11.Http11NioProtocol - Starting ProtocolHandler ["http-nio-8081"]
47+
18:06:24.094 [main] INFO o.s.b.w.e.tomcat.TomcatWebServer - Tomcat started on port(s): 8081 (http) with context path ''
48+
18:06:24.098 [DiscoveryClient-InstanceInfoReplicator-0] INFO c.netflix.discovery.DiscoveryClient - DiscoveryClient_MOVIE-CATALOG-SERVICE/192.168.1.7:movie-catalog-service:8081 - registration status: 204
49+
18:06:24.098 [main] INFO o.s.c.n.e.s.EurekaAutoServiceRegistration - Updating port to 8081
50+
18:06:24.105 [main] INFO i.j.m.MovieCatalogServiceApplication - Started MovieCatalogServiceApplication in 11.192 seconds (JVM running for 12.656)
51+
18:06:34.771 [http-nio-8081-exec-1] INFO o.a.c.c.C.[Tomcat].[localhost].[/] - Initializing Spring DispatcherServlet 'dispatcherServlet'
52+
18:06:34.775 [http-nio-8081-exec-1] INFO o.s.web.servlet.DispatcherServlet - Initializing Servlet 'dispatcherServlet'
53+
18:06:34.883 [http-nio-8081-exec-1] INFO o.s.web.servlet.DispatcherServlet - Completed initialization in 107 ms
54+
18:06:34.968 [http-nio-8081-exec-1] INFO i.j.m.r.TestConfigLocationController - Testing the location of config file for movie-catalog-service
55+
18:06:53.968 [DiscoveryClient-CacheRefreshExecutor-0] INFO c.netflix.discovery.DiscoveryClient - Disable delta property : false
56+
18:06:53.969 [DiscoveryClient-CacheRefreshExecutor-0] INFO c.netflix.discovery.DiscoveryClient - Single vip registry refresh property : null
57+
18:06:53.969 [DiscoveryClient-CacheRefreshExecutor-0] INFO c.netflix.discovery.DiscoveryClient - Force full registry fetch : false
58+
18:06:53.970 [DiscoveryClient-CacheRefreshExecutor-0] INFO c.netflix.discovery.DiscoveryClient - Application is null : false
59+
18:06:53.970 [DiscoveryClient-CacheRefreshExecutor-0] INFO c.netflix.discovery.DiscoveryClient - Registered Applications size is zero : true
60+
18:06:53.970 [DiscoveryClient-CacheRefreshExecutor-0] INFO c.netflix.discovery.DiscoveryClient - Application version is -1: false
61+
18:06:53.970 [DiscoveryClient-CacheRefreshExecutor-0] INFO c.netflix.discovery.DiscoveryClient - Getting all instance registry info from the eureka server
62+
18:06:54.012 [DiscoveryClient-CacheRefreshExecutor-0] INFO c.netflix.discovery.DiscoveryClient - The response status is 200
63+
18:07:35.868 [Thread-7] INFO o.s.c.n.e.s.EurekaServiceRegistry - Unregistering application MOVIE-CATALOG-SERVICE with eureka with status DOWN
64+
18:07:35.869 [Thread-7] WARN c.netflix.discovery.DiscoveryClient - Saw local status change event StatusChangeEvent [timestamp=1586954255869, current=DOWN, previous=UP]
65+
18:07:35.870 [DiscoveryClient-InstanceInfoReplicator-0] INFO c.netflix.discovery.DiscoveryClient - DiscoveryClient_MOVIE-CATALOG-SERVICE/192.168.1.7:movie-catalog-service:8081: registering service...
66+
18:07:35.878 [Thread-7] INFO o.s.s.c.ThreadPoolTaskExecutor - Shutting down ExecutorService 'applicationTaskExecutor'
67+
18:07:35.883 [DiscoveryClient-InstanceInfoReplicator-0] INFO c.netflix.discovery.DiscoveryClient - DiscoveryClient_MOVIE-CATALOG-SERVICE/192.168.1.7:movie-catalog-service:8081 - registration status: 204
68+
18:07:35.914 [Thread-7] INFO c.netflix.discovery.DiscoveryClient - Shutting down DiscoveryClient ...
69+
18:07:38.916 [Thread-7] INFO c.netflix.discovery.DiscoveryClient - Unregistering ...
70+
18:07:38.927 [Thread-7] INFO c.netflix.discovery.DiscoveryClient - DiscoveryClient_MOVIE-CATALOG-SERVICE/192.168.1.7:movie-catalog-service:8081 - deregister status: 200
71+
18:07:38.953 [Thread-7] INFO c.netflix.discovery.DiscoveryClient - Completed shut down of DiscoveryClient

‎movie-catalog-service/src/main/java/io/javabrains/moviecatalogservice/resources/TestConfigLocationController.java

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package io.javabrains.moviecatalogservice.resources;
22

33
import org.bouncycastle.asn1.pkcs.SafeBag;
4+
import org.slf4j.Logger;
5+
import org.slf4j.LoggerFactory;
46
import org.springframework.beans.factory.annotation.Value;
57
import org.springframework.cloud.context.config.annotation.RefreshScope;
68
import org.springframework.web.bind.annotation.GetMapping;
@@ -10,11 +12,14 @@
1012
@RefreshScope
1113
public class TestConfigLocationController {
1214

15+
private static final Logger LOG = LoggerFactory.getLogger(TestConfigLocationController.class);
16+
1317
@Value("${test.config.location}")
1418
private String testConfigLocation;
1519

1620
@GetMapping("/configLocation")
1721
public String getTestConfigLocation(){
22+
LOG.info("Testing the location of config file for movie-catalog-service");
1823
return testConfigLocation;
1924
}
2025

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<configuration>
3+
4+
<property name="DEV_HOME" value="logs" />
5+
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
6+
<layout class="ch.qos.logback.classic.PatternLayout">
7+
<Pattern>
8+
%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n
9+
</Pattern>
10+
</layout>
11+
</appender>
12+
13+
<appender name="FILE-AUDIT"
14+
class="ch.qos.logback.core.rolling.RollingFileAppender">
15+
<file>${DEV_HOME}/movie-catalog-service.log</file>
16+
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
17+
<Pattern>
18+
%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n
19+
</Pattern>
20+
</encoder>
21+
22+
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
23+
<!-- rollover daily -->
24+
<fileNamePattern>${DEV_HOME}/archived/debug.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
25+
<timeBasedFileNamingAndTriggeringPolicy
26+
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
27+
<maxFileSize>10MB</maxFileSize>
28+
</timeBasedFileNamingAndTriggeringPolicy>
29+
</rollingPolicy>
30+
31+
</appender>
32+
33+
<!-- <logger name="com.mkyong" level="debug"-->
34+
<!-- additivity="false">-->
35+
<!-- <appender-ref ref="FILE-AUDIT" />-->
36+
<!-- </logger>-->
37+
38+
<root level="info">
39+
<appender-ref ref="FILE-AUDIT" />
40+
<appender-ref ref="CONSOLE" />
41+
</root>
42+
43+
</configuration>

0 commit comments

Comments
 (0)