[ 
http://jira.codehaus.org/browse/DOXIA-145?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_123189
 ] 

Vincent Siveton commented on DOXIA-145:
---------------------------------------

Basically, we need to improve logging in Sink, Parser and Macro.

Using Plexus AbstractLogEnabled seems the better way i.e. 
{noformat}
public class SinkAdapter
    extends AbstractLogEnabled
    implements Sink
{}
{noformat}

The actual problem is that Sinks are not used as plexus components. 
Instantiation is direct, i.e.:
{noformat}
MySink sink = new Sink( aWriter );
{noformat}
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.
{noformat}
public class SinkAdapter
    extends AbstractLogEnabled
    implements Sink
{
    private Logger logger;

    /** [EMAIL PROTECTED] */
    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;
    }
}
{noformat}

And specify the current logger during the instantiation, i.e.
{noformat}
MySink sink = new Sink( aWriter );
sink.setLogger( getLogger );
{noformat}

Other ideas?

> Adding logger feature
> ---------------------
>
>                 Key: DOXIA-145
>                 URL: http://jira.codehaus.org/browse/DOXIA-145
>             Project: Maven Doxia
>          Issue Type: New Feature
>          Components: Core, Modules, Sink API
>            Reporter: Vincent Siveton
>             Fix For: 1.0-beta-1
>
>
> Doxia needs to have logger capability insides

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to