Skip to content

Commit

Permalink
added time to example
Browse files Browse the repository at this point in the history
  • Loading branch information
christiangoerdes committed Nov 20, 2023
1 parent 98bb9a2 commit 99095a4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
9 changes: 3 additions & 6 deletions distribution/examples/logging/access/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@ The default implementation provides a [Apache Common Log](https://httpd.apache.o

You can provide optional `<additionalVariable>` to extend or override the default configuration.

#### Note that a portion of the configuration is defined in `log4j2_access.xml`.

## Running the example

This example will visit a website and logs the access to the console. We use some predefined variables already declared in
the `AccessLogInterceptor` and some additional variables to extend the default behaviour.

1. Run `examples/logging/access/service-proxy.sh`
2. Open your browser or curl http://localhost:2000
3. Check if membrane logged something like `127.0.0.1 "GET / HTTP/1.1" 200 0 - application/json`





3. Check if membrane logged something like `127.0.0.1 [20/11/2023:16:12:46 +0100] "GET /shop/v2/products/1 HTTP/1.1" 200 0 - [application/json]`
6 changes: 3 additions & 3 deletions distribution/examples/logging/access/log4j2_access.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
<PatternLayout pattern="%d{ABSOLUTE} %5p %c{1}:%L - %m%n" />
</Console>
<Console name="ACCESS" target="SYSTEM_OUT">
<PatternLayout pattern="%X{ip} &quot;%X{http.method} %X{uri} %X{proto}/%X{http.version}&quot; %X{statusCode} %X{req.payload.size} [%X{res.contentType}]%n" />
<PatternLayout pattern="%X{ip} [%X{time.req.received.format}] &quot;%X{http.method} %X{uri} %X{proto}/%X{http.version}&quot; %X{statusCode} %X{req.payload.size} [%X{res.contentType}]%n" />
</Console>
<RollingFile name="ACCESS_FILE" fileName="access.log" filePattern="access.log.%i">
<PatternLayout pattern="%X{ip} &quot;%X{http.method} %X{uri} %X{proto}/%X{http.version}&quot; %X{statusCode} %X{req.payload.size} [%X{res.contentType}]%n" />
<PatternLayout pattern="%X{ip} [%X{time.req.received.format}] &quot;%X{http.method} %X{uri} %X{proto}/%X{http.version}&quot; %X{statusCode} %X{req.payload.size} [%X{res.contentType}]%n" />
<Policies>
<SizeBasedTriggeringPolicy size="100 MB" />
</Policies>
Expand All @@ -24,4 +24,4 @@
<AppenderRef ref="STDOUT" />
</Root>
</Loggers>
</Configuration>
</Configuration>

0 comments on commit 99095a4

Please sign in to comment.