You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by bu...@apache.org on 2011/09/08 04:55:25 UTC

DO NOT REPLY [Bug 51784] New: logger adapter, delagate call to logging method

https://issues.apache.org/bugzilla/show_bug.cgi?id=51784

             Bug #: 51784
           Summary: logger adapter, delagate call to logging method
           Product: Log4j
           Version: 1.2
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Other
        AssignedTo: log4j-dev@logging.apache.org
        ReportedBy: lc.pvrr@orange.fr
    Classification: Unclassified


In my project JOAFIP I wanted to be independant of the logging framework.
I use log4j by default because it is my preference and it is commonly used.
But not all project use log4j, so I wanted to be open to alternative.

This make me create an adapter, see attachment.
for example Logger.error(...) in my code is replaced by JoafipLogger.error(...)
and JoafipLogger.error delegate to org.apache.log4j.Logger.error(...)

But I discovered using "[%5p] - %d [%t] (%c.java:%M:%L) %n %m%n%n" as
conversion pattern that line number was wrong. So I created the attached code.

ideally a method Logger.setFQCN("net.sf.joafip.logger.JoafipLogger") would me
able to solve the problem. But I have to write the attached code to have the
issue.

What do you think to add Logger.setFQCN method ?

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


DO NOT REPLY [Bug 51784] logger adapter, delagate call to logging method

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51784

Curt Arnold <ca...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

--- Comment #1 from Curt Arnold <ca...@apache.org> 2011-09-09 04:54:54 UTC ---
An single instance of Logger is returned for any call to Logger.getLogger(). If
there were multiple "wrapping" classes wrapping the same instance of Logger,
they would be conflicting calls to setFQCN().

Is your wrapping class calling Logger.log(String callerFQCN, Priority level,
Object message, Throwable t)  which is designed for this scenarios? If so, are
you running into any problems.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


DO NOT REPLY [Bug 51784] logger adapter, delagate call to logging method

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51784

luc peuvrier <lc...@orange.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |NEW

--- Comment #2 from luc peuvrier <lc...@orange.fr> 2011-09-09 06:58:52 UTC ---
calling Logger.forcedLog(String callerFQCN, Priority level,Object message,
Throwable t) to "wrap" the logger is not because of multiples wrapping class.
There is only one proprietary logging class that delegate to log4j. I do not
see any reason to have multiple class for one project, but we can imagine
multiple project using the same approach, so it can exist more than one
"wrapping" class. so use of Logger.setFQCN is not a good solution.
may be better to have addtionnal parameter to logger functions.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org