[ 
https://issues.apache.org/jira/browse/JCS-241?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17937815#comment-17937815
 ] 

Piotr Karwasz commented on JCS-241:
-----------------------------------

{quote}
That would require big changes because we heavily rely on vararg Supplier<> 
parameters which System.Logger does not support.
I tested the current setup with both, JUL and Log4j2 and found the log messages 
to be ok.
Like:
> [2025-03-21 16:09:35] 
> org.apache.commons.jcs3.engine.control.CompositeCacheManager [INFORMATION] 
> Finished configuration in 2 ms.

What am I missing? 
{quote}

If you add some location-related pattern to your {{PatternLayout}} ({{%l}}, 
{{%C}}, {{%F}}, {{%M}} or {{%L}}), they will all point to the {{Log}} class.

BTW: Log4j API and SLF4J are location-aware and you can write wrappers that 
forward the correct line number that generated the event. The Log4j API has 
also a vararg Supplier<?> method, which could help in removing the wrapper too.

> Use System.Logger abstraction
> -----------------------------
>
>                 Key: JCS-241
>                 URL: https://issues.apache.org/jira/browse/JCS-241
>             Project: Commons JCS
>          Issue Type: Improvement
>            Reporter: Piotr Karwasz
>            Assignee: Piotr Karwasz
>            Priority: Minor
>             Fix For: jcs-4.0
>
>
> Commons JCS contains a logging wrapper in {{o.a.c.jcs3.log}}.
> Using a logging wrapper causes several issues:
> * Users need to set the hard to find {{jcs.logSystem}} system property to 
> switch between the JUL and Log4j API backend.
> * Both backends lose location information, which will always point to the 
> wrapper class as source of all log events.
> For this reason I propose to:
> * Rewrite Commons JCS to use the System.Logger API directly.
> * Deprecate the logging wrapper and related methods (e.g. 
> {{JCS.setLogSystem}}) for removal in the next major version.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to