Skip to content

Commit

Permalink
Make log4j example easier to run (newrelic#455)
Browse files Browse the repository at this point in the history
  • Loading branch information
alanwest authored Oct 4, 2023
1 parent e2e7b73 commit ee0f9bf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
8 changes: 2 additions & 6 deletions other-examples/java/logs-in-context-log4j2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,11 @@ The following image illustrates a similar example using FluentBit:
Next, build and run the application:

```shell
// Build the application
docker compose build
./gradlew logs-in-context-log4j2:bootJar

// Export your New Relic API key as an environment variable
export NEW_RELIC_API_KEY=<INSERT-API-KEY-HERE>

// Run the application and the collector with docker compose
docker compose up
// Build and run the application
docker compose up --build
```

Navigate to the app in a browser at `http://localhost:8080`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ services:
# Logs are forwarded to collector using fluentd
OTEL_LOGS_EXPORTER: none
OTEL_EXPORTER_OTLP_ENDPOINT: 'http://collector:4317'
OTEL_EXPERIMENTAL_RESOURCE_DISABLED_KEYS: 'process.command_line,process.command_args'
ports:
- '8080:8080'
logging:
Expand All @@ -23,6 +24,7 @@ services:
command: ["--config=/otel-config.yaml"]
environment:
LOG_EXPORTER_LOG_VERBOSITY: "detailed"
NEW_RELIC_OTLP_ENDPOINT: ${NEW_RELIC_OTLP_ENDPOINT}
NEW_RELIC_API_KEY: '${NEW_RELIC_API_KEY}'
ports:
- '4317:4317' # OTLP gRPC receiver
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ exporters:
logging:
verbosity: $LOG_EXPORTER_LOG_VERBOSITY
otlp:
endpoint: https://otlp.nr-data.net:4317
endpoint: $NEW_RELIC_OTLP_ENDPOINT
headers:
"api-key": $NEW_RELIC_API_KEY
service:
Expand Down

0 comments on commit ee0f9bf

Please sign in to comment.