Reputation: 388
How do we integrate the access logs in logback.xml? There is a class AccessLogHandler for this, but it does not implement MiddlewareHandler, so we cannot inject it in handlers.yml. Is there a simple way to log incoming HTTP requests in access.log like spring provides for tomcat?
Upvotes: 0
Views: 201
Reputation: 388
The AccessLogHandler can be put into the handler.yml to change the logging level via the endpoints provided on the fly. You are right that it is not a middleware handler but an endpoint handler.
If you are using light-4j as a monolithic app, then you can enable the audit log with the AuditHandler. It will log all the requests just like the Tomcat into the audit.log by default. The configuration in the logback.xml can be found at https://github.com/networknt/light-example-4j/blob/release/rest/openapi/petstore/src/main/resources/logback.xml#L44 as an example.
If you are using light-4j as a microservices platform, then the above approach is not working. The following three options can be used individually or combined.
If you are using Kubernetes or Openshift, please consult the document to redirect the logs to the console.
https://doc.networknt.com/concern/metrics/ https://doc.networknt.com/concern/prometheus/
https://doc.networknt.com/tutorial/tracing/
Upvotes: 0