[NO-ISSUE] Add column
This commit is contained in:
parent
8d078ebb10
commit
f4ffd2ec4e
16
README.md
16
README.md
|
@ -1,8 +1,7 @@
|
||||||
|
|
||||||
|
|
||||||
## `LoggingTestAPIController.java`
|
## `LoggingTestAPIController.java`
|
||||||
|
|
||||||
### logging test - get w/ body
|
### logging test - get w/ body
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
curl -X GET 'http://localhost:20090/api/v1/loggingTest/getWithBody' \
|
curl -X GET 'http://localhost:20090/api/v1/loggingTest/getWithBody' \
|
||||||
--header 'Content-Type: application/json' \
|
--header 'Content-Type: application/json' \
|
||||||
|
@ -15,19 +14,19 @@ curl -X GET 'http://localhost:20090/api/v1/loggingTest/getWithBody' \
|
||||||
```
|
```
|
||||||
|
|
||||||
### logging test - get w/ param
|
### logging test - get w/ param
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
curl http://localhost:20090/api/v1/loggingTest/get?p1=v1&p2=v2
|
curl http://localhost:20090/api/v1/loggingTest/get?p1=v1&p2=v2
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### logging test - post w/o body, w/ error
|
### logging test - post w/o body, w/ error
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
curl -X POST 'http://localhost:20090/api/v1/loggingTest/postWithBody'
|
curl -X POST 'http://localhost:20090/api/v1/loggingTest/postWithBody'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### logging test - post w/ body
|
### logging test - post w/ body
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
curl -X POST 'http://localhost:20090/api/v1/loggingTest/postWithBody' \
|
curl -X POST 'http://localhost:20090/api/v1/loggingTest/postWithBody' \
|
||||||
--header 'Content-Type: application/json' \
|
--header 'Content-Type: application/json' \
|
||||||
|
@ -38,16 +37,17 @@ curl -X POST 'http://localhost:20090/api/v1/loggingTest/postWithBody' \
|
||||||
}'
|
}'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
# Appendix
|
# Appendix
|
||||||
|
|
||||||
## schema.sql for other dbms
|
## schema.sql for other dbms
|
||||||
|
|
||||||
### mysql
|
### mysql
|
||||||
|
|
||||||
```mysql
|
```mysql
|
||||||
create table request_log
|
create table request_log
|
||||||
(
|
(
|
||||||
id bigint auto_increment primary key,
|
id bigint auto_increment primary key,
|
||||||
|
application_name varchar(64),
|
||||||
http_method varchar(255),
|
http_method varchar(255),
|
||||||
uri varchar(255),
|
uri varchar(255),
|
||||||
query_string varchar(2047),
|
query_string varchar(2047),
|
||||||
|
@ -62,6 +62,7 @@ create table request_log
|
||||||
create table response_log
|
create table response_log
|
||||||
(
|
(
|
||||||
id bigint auto_increment primary key,
|
id bigint auto_increment primary key,
|
||||||
|
application_name varchar(64),
|
||||||
http_status integer,
|
http_status integer,
|
||||||
content_type varchar(255),
|
content_type varchar(255),
|
||||||
body mediumtext,
|
body mediumtext,
|
||||||
|
@ -73,10 +74,12 @@ create table response_log
|
||||||
```
|
```
|
||||||
|
|
||||||
### postgresql
|
### postgresql
|
||||||
|
|
||||||
```postgresql
|
```postgresql
|
||||||
create table request_log
|
create table request_log
|
||||||
(
|
(
|
||||||
id bigint generated by default as identity primary key,
|
id bigint generated by default as identity primary key,
|
||||||
|
application_name varchar(64),
|
||||||
http_method varchar(255),
|
http_method varchar(255),
|
||||||
uri varchar(255),
|
uri varchar(255),
|
||||||
query_string varchar(255),
|
query_string varchar(255),
|
||||||
|
@ -90,6 +93,7 @@ create table request_log
|
||||||
create table response_log
|
create table response_log
|
||||||
(
|
(
|
||||||
id bigint generated by default as identity primary key,
|
id bigint generated by default as identity primary key,
|
||||||
|
application_name varchar(64),
|
||||||
http_status integer,
|
http_status integer,
|
||||||
content_type varchar(255),
|
content_type varchar(255),
|
||||||
body text,
|
body text,
|
||||||
|
|
|
@ -37,6 +37,7 @@ public class LoggingInterceptor implements HandlerInterceptor {
|
||||||
.body(getBodyIfAvailable(request))
|
.body(getBodyIfAvailable(request))
|
||||||
.requestedAt(Instant.now())
|
.requestedAt(Instant.now())
|
||||||
.traceId(MDC.get("traceId"))
|
.traceId(MDC.get("traceId"))
|
||||||
|
.applicationName("myoa-engineering-logging-sample")
|
||||||
.build();
|
.build();
|
||||||
loggingRequest(requestLog);
|
loggingRequest(requestLog);
|
||||||
logPersistenceService.save(requestLog);
|
logPersistenceService.save(requestLog);
|
||||||
|
@ -82,6 +83,7 @@ public class LoggingInterceptor implements HandlerInterceptor {
|
||||||
.body(getBodyIfAvailable(response))
|
.body(getBodyIfAvailable(response))
|
||||||
.respondedAt(Instant.now())
|
.respondedAt(Instant.now())
|
||||||
.traceId(MDC.get("traceId"))
|
.traceId(MDC.get("traceId"))
|
||||||
|
.applicationName("myoa-engineering-logging-sample")
|
||||||
.build();
|
.build();
|
||||||
loggingResponse(responseLog);
|
loggingResponse(responseLog);
|
||||||
logPersistenceService.save(responseLog);
|
logPersistenceService.save(responseLog);
|
||||||
|
|
|
@ -18,6 +18,7 @@ public class RequestLog extends Auditable {
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
private String applicationName;
|
||||||
private String httpMethod;
|
private String httpMethod;
|
||||||
private String uri;
|
private String uri;
|
||||||
private String queryString;
|
private String queryString;
|
||||||
|
|
|
@ -18,6 +18,7 @@ public class ResponseLog extends Auditable {
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
private String applicationName;
|
||||||
private Integer httpStatus;
|
private Integer httpStatus;
|
||||||
private String contentType;
|
private String contentType;
|
||||||
private String body;
|
private String body;
|
||||||
|
|
Loading…
Reference in New Issue