Expand my Community achievements bar.

AEM 6.2 , 6.3 : Custom Logs to log specific infomration

Avatar

Level 1

I have a java service class (say CookieServlet.class) and from this class I want to record a specific information (say the cookie set time) in a log file every time this class is invoked.

Creating a custom log file and having a log level of debug or info would display all the logs of this class where as i want to record only one specific information in a log file.

What can be the possible workaround ?

1 Reply

Avatar

Community Advisor

Hi,

To configure a custom log file, perform these steps.

1. In CRXDE Lite, select /apps/logsample/config.author.

2. Create a node with below configurations:

  • Type - sling:OsgiConfig
  • Name - org.apache.sling.commons.log.LogManager.factory.config-logsample-model

3. Add the following properties to this node:

  • org.apache.sling.commons.log.file (String) - logs/logsample-model.log (specifies the location of the custom log file)
  • org.apache.sling.commons.log.level (String) – debug
  • org.apache.sling.commons.log.names (String[]) - com.aem.logsample.core.models (specifies the Java package whose classes writes to this log file)
  • org.apache.sling.commons.log.pattern (String) - {0,date,yyyy-MM-dd HH:mm:ss.SSS} {4} [{3}] {5}

4. CLick Save.

Find community article for same at Creating a custom log file for an Adobe Experience Manager project

Thanks

Arun



Arun Patidar