Hi, I did experiment by my own. It needs to have org.apache.commons.logging.LogFactory inside the META-INF/services directory of the OSGi bundle.
Thanks! On Thu, Apr 23, 2015 at 7:19 PM, Ralph Goers <[email protected]> wrote: > Unfortunately, I have no OSGi experience and can’t answer your question. > There are others who participate on this list who do have experience and > maybe they can answer your question. > > Ralph > > On Apr 23, 2015, at 5:17 AM, Chathura Priyankara <[email protected]> > wrote: > > Hi Ralph, > > Thank you very much for the explanation. > One more question, If I use the Commons Logging Bridge in OSGi environment > do i need to include following resource > org.apache.commons.logging.LogFactory to the META-INF/services directory > of the OSGi bundle? > > Thanks, > Chathura. > > On Thu, Apr 23, 2015 at 5:38 PM, Ralph Goers <[email protected]> > wrote: > >> 1. That message comes from log4j 1.x so you still have its jar in the >> class path. >> 2. The Commons Logging bridge is not meant for you to code against. You >> should be coding t the commons logging API. The bridge then binds commons >> logging to log4j 2. >> >> Sent from my iPad >> >> On Apr 23, 2015, at 2:36 AM, Chathura Priyankara <[email protected]> >> wrote: >> >> Hi, >> >> I want to use log4j2 Commons Logging Bridge with commons 1.2. I tried to >> use something like follows: >> >> import org.apache.logging.log4j.jcl.LogFactoryImpl; >> public class MyClass{ >> >> private static Log log = >> LogFactoryImpl.getLog(DropinsBundleDeployer.class); >> . >> . >> . >> log.error("Error occured", e);} >> >> But when I'm running the code I'm getting following issue and cannot see >> any log: >> >> log4j:WARN Please initialize the log4j system properly. >> >> However the log4j2.xml file is in the class path. >> How can I correctly use commons logging 1.2 with log4j2 ? >> Thanks! >> Chathura. >> >> -- >> Chathura Priyankara, >> Faculty of Information Technology, >> University of Moratuwa. >> Blog : www.codeoncloud.blogspot.com >> >> > > > -- > Chathura Priyankara, > Faculty of Information Technology, > University of Moratuwa. > Blog : www.codeoncloud.blogspot.com > > > -- Chathura Priyankara, Faculty of Information Technology, University of Moratuwa. Blog : www.codeoncloud.blogspot.com
