openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nasseria1 <nasser.f...@gmail.com>
Subject Re: Use logback for OpenJPA as its logger
Date Sat, 17 Jul 2010 06:00:11 GMT

Donlads,
you are completely right, we are using logback 0.9.22 that is based on SLF4J

Thanks mike for your reply,
I guess you mean we should use 
http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_guide_logging_custom
custom logging  method. In this way we should extend a factory that is of
type org.apache.openjpa.lib.log.LogFactory.

This is a simple interface as below:

public interface LogFactory {
  public org.apache.openjpa.lib.log.Log getLog(String arg0);
}

its clear that we just needt to implement getLog method that simply returns
an instance of org.apache.openjpa.lib.log.Log
But the log that SLF4J factory returns (and we actually we require it) is
not compatible with it, it's of type org.slf4j.Logger when we use
LoggerFactory.getLogger(MyClass.class)
So, we are facing with the type compatibilty problem.

BTW, one possible solution is using adapter pattern that we design an
adapter class which implement org.apache.openjpa.lib.log.LogFactory and in
getLog 
method we should return the expected type (org.slf4j.Logger in our case)

However, I am not sure using adapter will solve this problem correctly, coz
its a bit cluttering and we assume it the last way.
so I m looking for a better solution.

However, thanks for sharing ideas
Waiting for any other ideas,
Nasser

-- 
View this message in context: http://openjpa.208410.n2.nabble.com/Use-logback-for-OpenJPA-as-its-logger-tp5287422p5305147.html
Sent from the OpenJPA Developers mailing list archive at Nabble.com.

Mime
View raw message