[
https://issues.apache.org/jira/browse/LOG4J2-138?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13541561#comment-13541561
]
Ralph Goers commented on LOG4J2-138:
------------------------------------
I've looked at your code. What you are doing is precisely why there is an SPI
with AbstractLoggerWrapper that does contain the log method. You are not a
simple user of the Log4j API but are creating your own logging framework. If
you were to simply use the Logger interface you would not be able to properly
use the ClassLoaderContextSelector. Using the AbstractLoggerWrapper you can.
You are also not taking advantage of features in Log4j 2.
I have uploaded an implementation of Log4j2Logger that makes better use of what
Log4j 2 offers. However, since you did not provide all the relevant helper
clases I can't be sure you won't have to make modifications to it. Note that I
didn't have to override all your debug and trace methods, although I did
override some of the log methods to take advantage of how Log4j 2 can better
support your use of DataObjects.
> org.apache.logging.log4j.Logger lacks some log(Level, String, ...) method
> -------------------------------------------------------------------------
>
> Key: LOG4J2-138
> URL: https://issues.apache.org/jira/browse/LOG4J2-138
> Project: Log4j 2
> Issue Type: Wish
> Components: API
> Affects Versions: 2.0-beta3
> Reporter: Pavel Trka
> Labels: API, log4j, logging, method
> Attachments: customFacade.zip, custom.zip
>
>
> Hello,
> I dont know if Im not alone with this problem but I encountered blocker in
> Log4j2 usage (blocker for me personally of course ;) ). Im posting it as Wish
> issue as it is not a bug.
> Im trying to switch from Log4j 1.2 to 2 and it looked like piece of cake but
> - I have developped some logging facade or wrapper solution around log4j 1.2,
> it's something like simple SLF4J, it was necessary because my project logging
> needs are pretty special and also I wanted to have the option to easilly
> switch logging frameworks.
> Problem is that most of my logging code is in own abstract class that is
> common for all implementations, concrete implementations are extending this
> base and have to implement only few methods like log(Level, String) and
> isLevelLoggable(Level) etc.. The advantage is that implementations are very
> simple to write with minimal amount of copy/paste programming.
> Problem is that the new org.apache.logging.log4j.Logger iface does not
> contain any log(...) method and Im stuck.
> I have only 2 options - I can use org.apache.logging.log4j.core.Logger class
> without using iface but I dont want that for obvious reasons - I want to do
> it properly. Second option is to implement all info(), debug(),trace(),....
> methods in my implementation class but I dont wanna do that because that is
> exactly what I wanted to avoid in my facade solution.
> I know it's my wish only, I dont know if this change had some good reasons
> but Im voting for adding some log() method to Logger iface ;) The same thing
> applies for missing getLevel() method but I already solved this one easilly
> so it's not my priority.
> Thanks,
> Pavel
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]