Expand my Community achievements bar.

SOLVED

Slinglog - How to get file name of Logger

Avatar

Level 2

Hi

I am trying to get the file name configured for the logger under /system/console/slinglog in my java application. for e.g. log.history is to mapped to "logs/history.log" so I want to get the "logs/history.log" if I provide "log.history"

Thanks in advance for taking time and helping! 

Thanks

Basheer

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi,

Use the configAdmin service and  do something like

configAdmin.listConfigurations("org.apache.sling.commons.log.LogManager.factory.config.*");

to find all log configurations. Then you have a logging configurations available in the system.

I haven't tested it, but it should work.

But: I cannot think of any reason, why you want to do it.

View solution in original post

2 Replies

Avatar

Correct answer by
Employee Advisor

Hi,

Use the configAdmin service and  do something like

configAdmin.listConfigurations("org.apache.sling.commons.log.LogManager.factory.config.*");

to find all log configurations. Then you have a logging configurations available in the system.

I haven't tested it, but it should work.

But: I cannot think of any reason, why you want to do it.

Avatar

Level 2

Thanks for the response. I tried last night the same option and it worked. Filter string within listConfigurations method is little different as below.

configAdmin.listConfigurations("(service.pid=org.apache.sling.commons.log.LogManager.factory.config.*)")

The reason is why I want to do this is I am trying to read the history.log file for the events