Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] Jetty Maven Plugin losing logging messages, suspect ClassLoader issue

Hiya,

Been trying to fix for a bit and believe I've tracked it down to a classloader issue and some how that means log4j isn't given access to the correct console to output to.

The project uses jetty for development and testing and various java ee containers, logging works in the java ee container but message are lost when using the jetty maven plugin for code loaded via the fake/mock ejb.

To change as little code as possible in jetty.xml I've defined some fake jndi look ups which essentially create ejb transaction boundaries, what a java ee container would do. i.e.

<New id="AbcService" class="org.eclipse.jetty.plus.jndi.Resource">
  <Arg />
  <Arg>ejb/tld.example.AbcService</Arg>
  <Arg>
    <New class="tld.example.AbcJettyBean" />
  </Arg>
</New>

Assume the following maven 4 projects;

helper
- helper classes, i.e. constants
service
- think EJB
service-jetty
- think EJB wrappers to fake ejb transaction boundaries
web
- web app


The helper class has a logging statement;

org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger("tld.example.helper");
if (logger.isDebugEnabled()) {
  System.out.println("message sysout");
  logger.debug("message logger");
}

AbdAction calls the helper and the "message sysout" and "message logger" both appear.
When AbcAction calls AbcJettyBean, that calls the AbcBean, that calls the helper... the "message sysout" appears but the "message logger" doesn't. So the logger thinks it's at debug but nothing appears on the console.

Any thoughts? Or should I raise as a bug? If so is it;
maven-jetty-plugin?
jetty jndi?
jetty?
slf4j?
log4j?

Cheers,
John


Back to the top