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


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="">
  <Arg />
    <New class="tld.example.AbcJettyBean" />

Assume the following maven 4 projects;

- helper classes, i.e. constants
- think EJB
- think EJB wrappers to fake ejb transaction boundaries
- 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;
jetty jndi?


Back to the top