Hi Maarten, No. I mean our custom tomcat components uses commons-logging as logging api. We are in the middle of leveraging modern logging frameworks for tomcat (e.g. logback). Introducing slf4j is the first step. Eventually log4j will be removed. So our use case looks a little bit confusing that as tomcat internal logging can goes to log4j directly without introducing sl4fj as intermediary.
The problem here I think is more than just logging to log4j, but it's a real limitation of slf4j bridges. Regards, Tom On Tue, Aug 10, 2010 at 5:52 PM, Maarten Bosteels <[email protected]> wrote: > You meant components that use slf4j ? > > Maarten > > 2010/8/10, Tom Liu <[email protected]>: >> That's true. However, we have some customized components which uses >> commons-logging. >> >> On Tue, Aug 10, 2010 at 5:11 PM, Maarten Bosteels >> <[email protected]> wrote: >>> Hi >>> You don't need slf4j at all to make tomcat 6 use log4j >>> See the tomcat docs. >>> >>> Maarten >>> >>> 2010/8/10, Tom Liu <[email protected]>: >>>> Hi Ceki, >>>> >>>> I opened the bug here: http://bugzilla.slf4j.org/show_bug.cgi?id=194 >>>> >>>> Thank you very much, >>>> Tom >>>> >>>> On Tue, Aug 10, 2010 at 3:09 PM, Ceki Gulcu <[email protected]> wrote: >>>>> Hi Tom, >>>>> >>>>> Sounds reasonable. Would you open a bug report requesting the change you >>>>> describe? Thanks, >>>>> >>>>> On 10.08.2010 06:38, Tom Liu wrote: >>>>>> >>>>>> Hi guys, >>>>>> >>>>>> I think log4j-over-slf4j (as well as jcl bridges) checks circular >>>>>> dependency too strict. >>>>>> Even when slf4j-log4j12.jar is visible, it does not necessarily mean >>>>>> it will be picked up by slf4j-api as the logging backend. >>>>>> >>>>>> Here is a setup in tomcat 6 demonstrate the issue: >>>>>> tomcat container lib contains: jcl-over-slf4j.jar, slf4j-api.jar, >>>>>> slf4j-log4j12.jar, log4j.jar >>>>>> Webapp WEB-INF/lib contains: log4j.jar, log4j-over-slf4j.jar, >>>>>> slf4j-api.jar, logback-core.jar, logback-access.jar. >>>>>> What we want to achieve is that tomcat logging (from commons-logging) >>>>>> will be routed to log4j and webapp's logging (from log4j) will be >>>>>> routed to logback. >>>>>> In theory, there will be no circular dependencies in runtime as >>>>>> logback is picked up as the logging backend. However, webapp failed to >>>>>> start because the "potential" circular dependency is detected. >>>>>> >>>>>> Is it possible to change the circular dependency detection algorithm >>>>>> to test against the actual binding picked up? I did a hack on >>>>>> org.apache.log4j.Log4jLoggerFactory which works for me: >>>>>> class Log4jLoggerFactory { >>>>>> ... >>>>>> >>>>>> static { >>>>>> >>>>>> LoggerFactoryBinder binder = StaticLoggerBinder.getSingleton(); >>>>>> if >>>>>> ("org.slf4j.impl.Log4jLoggerFactory".equals(binder.getLoggerFactoryClassStr())) >>>>>> { >>>>>> String part1 = "Detected both log4j-over-slf4j.jar AND >>>>>> slf4j-log4j12.jar on the class path, preempting StackOverflowError. >>>>>> REPLACED "; >>>>>> String part2 = "See also " + LOG4J_DELEGATION_LOOP_URL + " >>>>>> for more details."; >>>>>> >>>>>> Util.reportFailure(part1); >>>>>> Util.reportFailure(part2); >>>>>> throw new IllegalStateException(part1 + part2); >>>>>> } >>>>>> >>>>>> } >>>>>> ... >>>>>> >>>>>> } >>>>>> >>>>>> Thanks, >>>>>> Tom >>>>> >>>>> _______________________________________________ >>>>> slf4j-user mailing list >>>>> [email protected] >>>>> http://qos.ch/mailman/listinfo/slf4j-user >>>>> >>>> _______________________________________________ >>>> slf4j-user mailing list >>>> [email protected] >>>> http://qos.ch/mailman/listinfo/slf4j-user >>>> >>> _______________________________________________ >>> slf4j-user mailing list >>> [email protected] >>> http://qos.ch/mailman/listinfo/slf4j-user >> _______________________________________________ >> slf4j-user mailing list >> [email protected] >> http://qos.ch/mailman/listinfo/slf4j-user >> > _______________________________________________ > slf4j-user mailing list > [email protected] > http://qos.ch/mailman/listinfo/slf4j-user _______________________________________________ slf4j-user mailing list [email protected] http://qos.ch/mailman/listinfo/slf4j-user
