How to write page.model.json (Jackson Exporter in sling model) response to request.log in AEM | Community
Skip to main content
New Participant
July 20, 2023
Solved

How to write page.model.json (Jackson Exporter in sling model) response to request.log in AEM

  • July 20, 2023
  • 3 replies
  • 1431 views

Hi Team,

Our project is Remote SPA, the AEM page data is exposed by jackson exporter like content/my-site/us/en/sample-page.model.json. Each component is implemented by jackson exporter.


So I have a requirement of write each page.model.json request coming to AEM should be logged into logs/request.log.

 

Some details every sling model is implementing ComponentExporter (com.adobe.cq.export.json).

@arunpatidar 
Urgent requirement.

 

Thanking in advance

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by mahi1729

First of all it may not be a good idea to log the entire json into your log file for every request that comes to publisher, but if you really intend to have it, one option is adding a sling filter that intercepts all requests with mode.json as selector.extension configuration, and as part of that filter you can log the entire json response. Hope this info helps. Thanks !

3 replies

mahi1729
mahi1729Accepted solution
New Participant
August 3, 2023

First of all it may not be a good idea to log the entire json into your log file for every request that comes to publisher, but if you really intend to have it, one option is adding a sling filter that intercepts all requests with mode.json as selector.extension configuration, and as part of that filter you can log the entire json response. Hope this info helps. Thanks !

gskittuAuthor
New Participant
August 3, 2023

Hi @mahi1729 , Thanks for your reply. Yes it is correct, We have implemented with Filter that it interscept every request. But it is client requirement as we have to implement it.

DPrakashRaj
New Participant
July 21, 2023

If you see a network call to page.model.json then it should be logged in request.log.

EstebanBustamante
New Participant
July 20, 2023

Sorry I don't understand your question, I see the requests are being written in the request.log for the SPA remote as well, see below:

 

Esteban Bustamante
gskittuAuthor
New Participant
July 26, 2023

hi @estebanbustamante , Thanks for your reply, In request.log  it won't print .model.json response, I want it to print page.model.json response.