Skip to content

Commit d51ed24

Browse files
committed
ApiBoot Logging Sample 示例
1 parent 800f6ce commit d51ed24

File tree

6 files changed

+60
-5
lines changed

6 files changed

+60
-5
lines changed

api-boot-samples/api-boot-sample-logging/pom.xml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,15 @@
2222
<parent>
2323
<artifactId>api-boot-samples</artifactId>
2424
<groupId>org.minbox.framework</groupId>
25-
<version>2.1.1.RELEASE</version>
25+
<version>2.1.2-SNAPSHOT</version>
2626
</parent>
2727
<modelVersion>4.0.0</modelVersion>
2828
<description>
2929
ApiBoot Logging Sample
3030
</description>
31+
<properties>
32+
<spring.cloud.version>Greenwich.RELEASE</spring.cloud.version>
33+
</properties>
3134
<artifactId>api-boot-sample-logging</artifactId>
3235
<dependencies>
3336
<dependency>
@@ -39,16 +42,28 @@
3942
<groupId>org.minbox.framework</groupId>
4043
<artifactId>api-boot-starter-logging</artifactId>
4144
</dependency>
45+
<dependency>
46+
<groupId>org.springframework.cloud</groupId>
47+
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
48+
</dependency>
4249
</dependencies>
4350
<dependencyManagement>
4451
<dependencies>
4552
<dependency>
4653
<groupId>org.minbox.framework</groupId>
4754
<artifactId>api-boot-dependencies</artifactId>
48-
<version>2.1.1.RELEASE</version>
55+
<version>2.1.2-SNAPSHOT</version>
4956
<type>pom</type>
5057
<scope>import</scope>
5158
</dependency>
59+
<!--SpringCloud版本依赖-->
60+
<dependency>
61+
<groupId>org.springframework.cloud</groupId>
62+
<artifactId>spring-cloud-dependencies</artifactId>
63+
<version>${spring.cloud.version}</version>
64+
<scope>import</scope>
65+
<type>pom</type>
66+
</dependency>
5267
</dependencies>
5368
</dependencyManagement>
5469
<build>

api-boot-samples/api-boot-sample-logging/src/main/java/org/minbox/framework/api/boot/sample/logging/ApiBootLoggingApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
* GitHub:https://github.com/hengboy
3535
*/
3636
@SpringBootApplication
37-
public class ApiBootLoggingApplication {
37+
public class ApiBootLoggingApplication{
3838
/**
3939
* logger instance
4040
*/

api-boot-samples/api-boot-sample-logging/src/main/java/org/minbox/framework/api/boot/sample/logging/LocalNoticeSample.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,22 @@
3434
*/
3535
@Component
3636
public class LocalNoticeSample implements ApiBootLogNotice {
37+
/**
38+
* order 值越小执行越靠前
39+
*
40+
* @return
41+
*/
3742
@Override
3843
public int getOrder() {
3944
return 0;
4045
}
4146

47+
/**
48+
* 请求日志通知执行方法
49+
* ApiBootLog为一次请求日志对象基本信息
50+
*
51+
* @param apiBootLog ApiBoot Log
52+
*/
4253
@Override
4354
public void notice(ApiBootLog apiBootLog) {
4455
System.out.println(apiBootLog);
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
api:
2+
boot:
3+
logging:
4+
admin:
5+
server-address: user:123456@127.0.0.1:9090
6+
format-console-log-json: true
7+
number-of-request-log: 2
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
api:
2+
boot:
3+
logging:
4+
format-console-log-json: true
5+
number-of-request-log: 2
6+
discovery:
7+
service-id: iot-server-admin
8+
username: admin
9+
password: iot_adminv3
10+
ignore-paths:
11+
- /actuator/health
12+
13+
# Eureka Config
14+
eureka:
15+
client:
16+
service-url:
17+
defaultZone: http://service:nodev2@192.168.10.72:10001/eureka/
18+
instance:
19+
prefer-ip-address: true
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
spring:
22
application:
33
name: api-boot-sample-logging
4-
4+
profiles:
5+
active: appoint
56
logging:
67
level:
7-
org.minbox.framework.api.boot.plugin.logging: debug
8+
org.minbox.framework.api.boot.plugin.logging: debug
9+
server:
10+
port: 8080

0 commit comments

Comments
 (0)