Dear Community,
I have a sampleToolboxConfigurationPresenter class for my Toolbox configuration, as below:
public class sampleToolboxConfigurationPresenter extends samplePresenter {
private final Dao<sampleToolboxConfigurationDto> dao = new GenericSlingDao<sampleToolboxConfigurationDto>(sampleToolboxConfigurationDto.class);
/** {@inheritDoc} */
@Override
public sampleToolboxConfigurationModel getModelFromResource(SlingHttpServletRequest request,Resource resource) {
sampleToolboxConfigurationDto dto = dao.getDtoOrNewOnError(resource);
return new sampleToolboxConfigurationModel(dto);
}
}
Could you please let me know In The above code How can I get the attributes of dto by using the loggers .And how can I use the loggers for debuging.
Solved! Go to Solution.
Views
Replies
Total Likes
It should state in the AEM docs that you need to go here:
http://localhost:4502/system/console/configMgr
Look for Apache Sling Logging Configuration - as shown here:
Hope this helps
Views
Replies
Total Likes
To log messages in AEM - you simply create an instance of http://www.slf4j.org/api/org/slf4j/Logger.html:
/** Default log. */
protected final Logger log = LoggerFactory.getLogger(this.getClass());
then write out what you want:
log.debug("This will log out");
See this community article that logs messages:
https://helpx.adobe.com/experience-manager/using/developing-aem-osgi-bundles-jackrabbit.html
Views
Replies
Total Likes
Hi Scott,
Thanks for your quick reply.
I added the log in my SampleToolboxConfigurationPresenter class file, as shown below.
public class SampleToolboxConfigurationPresenter extends AbstractPresenter {
protected final Logger LOG = LoggerFactory.getLogger(this.getClass());
private final Dao<SampleToolboxConfigurationDto> dao = new GenericSlingDao<SampleToolboxConfigurationDto>(
SampleToolboxConfigurationDto.class);
/** {@inheritDoc} */
@Override
public SampleToolboxConfigurationModel getModelFromResource(SlingHttpServletRequest request,
Resource resource) {
LOG.debug("This will log out");
LOG.info("Temperature has risen above 50 degrees.");
SampleToolboxConfigurationDto dto = dao.getDtoOrNewOnError(resource);
return new SampleToolboxConfigurationModel(dto);
}
}
But I am not bale to see my log entry in any of the files.
access.log , history.log , request.log
Thanks,
Sonu
Views
Replies
Total Likes
Its error.log - that is where its written too.
Views
Replies
Total Likes
Have you changed Logger log mode?. You should change it to debug mode from OSGI config to get debug message in log file.
https://docs.adobe.com/docs/en/aem/6-1/deploy/configuring/configure-logging.html
--
Jitendra
Views
Replies
Total Likes
Hi Jitendra,
I did not changed Logger log mode?.
You should change it to debug mode from OSGI config to get debug message in log file.
https://docs.adobe.com/docs/en/aem/6-1/deploy/configuring/configure-logging.html
I followed the adobe document but did not understand much.
Could you please send me the screenshot, how can I change it in OSGI config.
Thanks,
Sunita
Views
Replies
Total Likes
It should state in the AEM docs that you need to go here:
http://localhost:4502/system/console/configMgr
Look for Apache Sling Logging Configuration - as shown here:
Hope this helps
Views
Replies
Total Likes
Views
Replies
Total Likes