Basically, we need to improve logging in Sink, Parser and Macro.
Using Plexus AbstractLogEnabled seems the better way i.e.
The actual problem is that Sinks are not used as plexus components. Instantiation is direct, i.e.:
due NPE when calling getLogger()
A solution could be to refactor all sinks, parser and macro to use them as components.
We could also need to specify a logger, i.e.
And specify the current logger during the instantiation, i.e.
Other ideas?
Basically, we need to improve logging in Sink, Parser and Macro.
Using Plexus AbstractLogEnabled seems the better way i.e.
public class SinkAdapter extends AbstractLogEnabled implements Sink {}The actual problem is that Sinks are not used as plexus components. Instantiation is direct, i.e.:
due NPE when calling getLogger()
A solution could be to refactor all sinks, parser and macro to use them as components.
We could also need to specify a logger, i.e.
public class SinkAdapter extends AbstractLogEnabled implements Sink { private Logger logger; /** {@inheritDoc} */ public final Logger getLogger() { if ( logger == null ) { if ( super.getLogger() != null ) { logger = super.getLogger(); } else { logger = new Slf4jLogger( Logger.LEVEL_DEBUG, LoggerFactory.getLogger( getClass() )); } } return logger; } public final void setLogger( Logger logger ) { this.logger = logger; } }And specify the current logger during the instantiation, i.e.
Other ideas?
public class SinkAdapter extends AbstractLogEnabled implements Sink {}public class SinkAdapter extends AbstractLogEnabled implements Sink { private Logger logger; /** {@inheritDoc} */ public final Logger getLogger() { if ( logger == null ) { if ( super.getLogger() != null ) { logger = super.getLogger(); } else { logger = new Slf4jLogger( Logger.LEVEL_DEBUG, LoggerFactory.getLogger( getClass() )); } } return logger; } public final void setLogger( Logger logger ) { this.logger = logger; } }