Expand my Community achievements bar.

SOLVED

How we can do logger configuration In AEM as cloud instance?

Avatar

Level 2

we need to do configuration for all envinorments

AEM Environment   |  Log Level

->Developement      |   Debug

--> Stage -----            |    WARN

--> PROD -----           |     Error

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@ramsaipavan 

You can create logger configuration in ui.config folder based on run modes. Environment variable can be used while defining the value of log level and it can be changed at runtime.

{
"org.apache.sling.commons.log.names": [
"com.adobe.aem.guides.wknd"
],
"org.apache.sling.commons.log.level":

"$[env:LOG_LEVEL;default=ERROR]"


}

https://github.com/adobe/aem-guides-wknd/blob/main/ui.config/src/main/content/jcr_root/apps/wknd/osg...

 

 

View solution in original post

5 Replies

Avatar

Correct answer by
Community Advisor

@ramsaipavan 

You can create logger configuration in ui.config folder based on run modes. Environment variable can be used while defining the value of log level and it can be changed at runtime.

{
"org.apache.sling.commons.log.names": [
"com.adobe.aem.guides.wknd"
],
"org.apache.sling.commons.log.level":

"$[env:LOG_LEVEL;default=ERROR]"


}

https://github.com/adobe/aem-guides-wknd/blob/main/ui.config/src/main/content/jcr_root/apps/wknd/osg...

 

 

Avatar

Community Advisor

@ramsaipavan 

Yes you can use single file under config folder for all runmodes and then set the desired log level value using environment variable

 

 

Avatar

Level 2

@AMANATH_ULLAH 

 

 

Cloud manager setting
The environmental configuration in all environments like dev, qa, stage and prod 
Like name =LOG_LEVEL,  value =debug,  services= all  and type = variable 

 

Can I write like this inside config file as below to run all environments

{
"org.apache.sling.commons.log.names": [
"com.adobe.aem.guides.wknd"
],

"org.apache.sling.commons.log.level": "$[env:LOG_LEVEL;default=DEBUG]",
"org.apache.sling.commons.log.level": "WARN",
"org.apache.sling.commons.log.level": "ERROR",
"org.apache.sling.commons.log.file": "logs/error.log",
 "org.apache.sling.commons.log.additiv": "true"
}

Avatar

Community Advisor

@ramsaipavan 

Yes you can add the configuration as below in single config file and then you can set the environment variable in Cloud manager for each environment

 

{
"org.apache.sling.commons.log.names": [
"com.adobe.aem.guides.wknd"
],
"org.apache.sling.commons.log.level":

"$[env:LOG_LEVEL;default=ERROR]"


}