By default in request.log file will get request(method,protocal),response (status code,response time) and protocal details.If I want to log same as request.log file in other custom log file(Ex:error.log). Is there any configuation I need to add ?
Solved! Go to Solution.
Views
Replies
Total Likes
I don't think that this is possible, because the request.log file is called via an abstraction (https://github.com/apache/sling-org-apache-sling-engine/blob/master/src/main/java/org/apache/sling/e...) at specific places in the sling engine process handling.
And you cannot register your code as a RequestLoggerService because that service interface is not public.
So this is not possible.
Hi @vijitha ,
Could you please confirm what is the use case you want to achieve with another custom request log file? Though just try creating new log file using "log.request" logger type as slinglog.
Thanks,
Ritesh Mittal
usecase is to monitoring and to check site performance. we need to add request,response and protocal details to all custom log files in project.
You can't have the same classes bind to 2 different log files, so if you really need to put the request.log info into the error.log you could do it but I won't advise that, there is a reason why these two were split in the first place, so be careful if you really need to do this.
For merging the request.log into the error.log, you only have to add the "log.request" within the error.log definition.
But I am curious why would you need this in the first place. It seems odd to me.
Here you can learn more about logging:
- https://www.baeldung.com/java-logging-intro
- http://www.sgaemsolutions.com/2019/12/aem-logs-in-detail-part-2.html
I don't to bind or merge those two. I need request,response details in my custom log file[PFA].
As explained, you cannot have that information in both files, you need to keep it in one, see my previous response about how to do it.
I don't think that this is possible, because the request.log file is called via an abstraction (https://github.com/apache/sling-org-apache-sling-engine/blob/master/src/main/java/org/apache/sling/e...) at specific places in the sling engine process handling.
And you cannot register your code as a RequestLoggerService because that service interface is not public.
So this is not possible.
Views
Likes
Replies