Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

2 'Sling Logging Logger Configuration' with same Logger Names, but different levels

Avatar

Level 2

Hello,

I’m trying to create two Sling Logging Logger Configuration one for the log level “INFO” and one for the log level “WARN”, and both for the same Logger Name.

But only the “INFO” level one is working. It’s not possibly to log the same logger name at different levels into two different files?

Here is my code :

#org.apache.sling.commons.log.LogManager.factory.config-1

org.apache.sling.commons.log.LogManager.factory.config.1.org.apache.sling.commons.log.level="warn"

org.apache.sling.commons.log.LogManager.factory.config.1.org.apache.sling.commons.log.file="logs/1.log"

org.apache.sling.commons.log.LogManager.factory.config.1.org.apache.sling.commons.log.names="[name1,name2]"

 

#org.apache.sling.commons.log.LogManager.factory.config-2

org.apache.sling.commons.log.LogManager.factory.config.2.org.apache.sling.commons.log.level="info"

org.apache.sling.commons.log.LogManager.factory.config.2.org.apache.sling.commons.log.file="logs/2.log"

org.apache.sling.commons.log.LogManager.factory.config.2.org.apache.sling.commons.log.names="[name1,name2]"

3 Replies

Avatar

Level 2

I dont think its possible,when i tried configuring 2nd logged  via http://localhost:4502/system/console/slinglog , it didnt even allow me to save the second entry.

Avatar

Level 9

Hello,

It will not allow you to do that until you are not using common logging name. One thing which is not clear to me, why you want to create same login twice because OOTB INFO will also cover WARN logs (until you override initvalue for log) so why you want two.

 

Thanks,

Pawan

Avatar

Level 2

Hi, thanks for the answer.

I want to create 2 log files because we use another application which display logs by log files.

On one window we want to display only errors, and on the other we want to display info logs (no problem if there is also errors inside).

 

What do you mean by 'It will not allow you to do that until you are not using common logging name' ?

On the example, we replaced the 'real names' by [name1,name2], but it's just for the example.