-
Notifications
You must be signed in to change notification settings - Fork 100
feat: add log4j2 configuration #214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| <dependency> | ||
| <groupId>com.lmax</groupId> | ||
| <artifactId>disruptor</artifactId> | ||
| <version>3.4.4</version> | ||
| </dependency> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a complete framework or just a logging component?
What is the link to its repository?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
disruptor is a "High Performance Inter-Thread Messaging Library" . Log4j2 uses this lib to implement async logging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this lib added, will the java runner logs be output in APISIX?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is log4j2.xml decides whether runner's logs be output in APISIX. Now runners log will not be send to APISIX. If users want to send logs to apisix, they need add following code in log4j2.xml:
Add a appender:
<Console name="CONSOLE" target="SYSTEM_OUT" follow="true">
<PatternLayout charset="${FILE_ENCODING}">
<pattern>%d %-5p %-32t - %m%n %throwable</pattern>
</PatternLayout>
</Console>Add appender above to loggers:
<appender-ref ref="CONSOLE"/>There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to set the system property log4j2.contextSelector to org.apache.logging.log4j.core.async.AsyncLoggerContextSelector ref: https://logging.apache.org/log4j/2.x/manual/async.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already set <asyncRoot>, so there is no need to set system property "log4j2.contextSelector" to any value.
|
we need to add log path to https://github.com/apache/apisix-java-plugin-runner/blob/main/.gitignore#L25 |
|
@OrezzerO merged, many thanks. |
Please answer these questions before submitting a pull request
Why submit this pull request?
Bugfix
New feature provided
Improve performance
Related issues
New feature or improvement
Describe the details and related test reports.
Add log4j configuration. The logs will be at
${user.dir}/logs/java-runner-common-default.logand${user.dir}/logs/java-runner-common-error.log. In apisix env,${user.dir}generally equals/usr/local/apisix/.Source branch
Related commits and pull requests
Target branch
Related issue: #22