[
http://issues.ops4j.org/jira/browse/PAXLOGGING-17?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_10982
]
Damian Golda commented on PAXLOGGING-17:
----------------------------------------
No, I think this is not usage of MDCs nor NDCs.
It's 3rd overloaded "log" method, the others are:
void log(Priority priority, Object message)
void log(Priority priority, Object message, Throwable t)
While my missing method has one more parameter - String callerFQCN:
void log(String callerFQCN, Priority level, Object message, Throwable t)
It seems to be SPI interface, because all of them have comment:
/**
This generic form is intended to be used by wrappers.
*/
And actually in c3p0 they are use in c3p0 log4j wrapper - class
com.mchange.v2.log.log4j.Log4jMLog.
So it is against implementing it in pax-logging, because as I understand
pax-logging is API compatible not SPI compatible.
But... there is a precedence: method void log(Priority priority, Object
message) is already implemented in pax-logging!
So why not implement other log method??? For example:
public void log(String callerFQCN, Priority level, Object msg, Throwable t)
{
// ignore callerFQCN parameter
if( priority == Level.FATAL )
{
this.fatal( msg , t );
}
if( priority == Level.ERROR )
{
this.error( msg , t );
}
if( priority == Level.WARN )
{
this.warn( msg , t );
}
if( priority == Level.INFO )
{
this.info( msg , t );
}
if( priority == Level.DEBUG )
{
this.debug( msg , t );
}
if( priority == Level.ALL )
{
this.trace( msg , t );
}
}
I think callerFQCN may be ignored. In c3p0 it is hardcoded string with
Log4jMLogger class name. In log4j Category FQCN = Category.class.getName().
Of course I can manage without it - I can create own MLogger for c3p0, using
supported by pax-logging API.
But I think it would be worse for other pax-logging users.
> NoSuchMethodError:
> org.apache.log4j.Logger.log(Ljava/lang/String;Lorg/apache/log4j/Priority;Ljava/lang/Object;Ljava/lang/Throwable;)V
> -------------------------------------------------------------------------------------------------------------------------------------
>
> Key: PAXLOGGING-17
> URL: http://issues.ops4j.org/jira/browse/PAXLOGGING-17
> Project: Pax Logging
> Issue Type: Bug
> Environment: pax logging 0.9.8, c3p0 0.9.1
> Reporter: Damian Golda
> Assignee: Niclas Hedhman
>
> Error while creating instance of com.mchange.v2.c3p0.ComboPooledDataSource:
> Instantiation of bean failed;
> Caused by: java.lang.NoSuchMethodError:
> org.apache.log4j.Logger.log(Ljava/lang/String;Lorg/apache/log4j/Priority;Ljava/lang/Object;Ljava/lang/Throwable;)V
>
> at com.mchange.v2.log.log4j.Log4jMLog$Log4jMLogger.log(Log4jMLog.java:159)
> at com.mchange.v2.log.log4j.Log4jMLog$Log4jMLogger.log(Log4jMLog.java:162)
> at com.mchange.v2.log.MLog.<clinit>(MLog.java:80)
> at
> com.mchange.v2.naming.JavaBeanReferenceMaker.<clinit>(JavaBeanReferenceMaker.java:39)
>
> at
> com.mchange.v2.c3p0.impl.PoolBackedDataSourceBase.<clinit>(PoolBackedDataSourceBase.java:203)
>
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> Log4jMLog:159:
> private void log(Level lvl, Object msg, Throwable t)
> { logger.log( FQCN, lvl, msg, t ); }
> where FQCN is String:
> final static String FQCN = Log4jMLogger.class.getName();
> So it is called:
> Category.log(String, Level, Object, Throwable) which is not present in Logger
> from pax-logging-api!!!
> This metod is still present in log4j 1.2.15:
> /**
> This is the most generic printing method. It is intended to be
> invoked by <b>wrapper</b> classes.
> @param callerFQCN The wrapper class' fully qualified class name.
> @param level The level of the logging request.
> @param message The message of the logging request.
> @param t The throwable of the logging request, may be null. */
> public
> void log(String callerFQCN, Priority level, Object message, Throwable t)
> So I think pax-logging must support it to be compatible with log4j.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.ops4j.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
_______________________________________________
general mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/general