[ 
https://issues.apache.org/jira/browse/PROTON-343?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13695403#comment-13695403
 ] 

Philip Harvey edited comment on PROTON-343 at 7/1/13 10:50 AM:
---------------------------------------------------------------

Here are some rough notes about how the code should look that I agreed with 
Robbie and Rob.  The previously-attached patch will be modified in line with 
the notes below.

{code}
//Applications can plug in custom behaviour in several ways:

engineFactory.setEngineLogger(myCustomEngineLogger)

engineFactory.setEngineLogger(new CategoryLoggerWrapper(myCustomCategoryLogger))

CategoryLoggerWrapper.setDefaultCategoryLogger(myCustomCategoryLogger)

connection.setEngineLogger(myCustomEngineLogger)
((CategoryLoggerWrapper)connection.getEngineLogger()).setCategoryLogger(myCustomCategoryLogger)

// How the new JMS client will probably do it:
class JMSConnectionImpl
{
    CategoryLoggerWrapper.setDefaultCategoryLogger(new Slf4JCategoryLogger()); 
// defined in Proton
}


// public class defined in proton-api
public class CategoryLoggerWrapper implements EngineLogger, MessengerLogger...
{
    private static final JUL_CATEGEORY_LOGGER = new JulCategoryLogger()
        
        private CategoryLogger _categoryLogger = JUL_CATEGEORY_LOGGER // or use 
the logger defined in a system property if set
        
    static setDefaultCategoryLogger(logger);
   
    setCategoryLogger(logger)

    logFrameReceived(Connection, ....)
        {
                _categoryLogger.log(FRAME_CATEGORY, "blah blah")
        }
        
        logMessengerStuff(...)
}

// used by Python tests
public class RememberingLogger implements EngineLogger
{
   ... just remembers its invocations so we can assertion correct behaviour of 
ConnectionImpl
}


class EngineFactoryImpl
{
    public Connection createConnection()
    {
        conn = return new ConnectionImpl(_engineLogger);
    }
}
   
class SenderImpl
{
   ...
   getEngineLogger().logStuff(getConnection(), ....)
}
{code}
                
      was (Author: philharveyonline):
    Here are some rough notes about how the code should look that I agreed with 
Robbie and Rob.  The previously-attached patch will be modified in line with 
the notes below.

{code}
//Applications can plug in custom behaviour in several ways:

engineFactory.setEngineLogger(myCustomEngineLogger)

engineFactory.setEngineLogger(new CategoryLoggerWrapper(myCustomEngineLogger))

CategoryLoggerWrapper.setDefaultCategoryLogger(myCustomCategoryLogger)

connection.setEngineLogger(myCustomEngineLogger)
((CategoryLoggerWrapper)connection.getEngineLogger()).setCategoryLogger(myCustomCategoryLogger)

// How the new JMS client will probably do it:
class JMSConnectionImpl
{
    CategoryLoggerWrapper.setDefaultCategoryLogger(new Slf4JCategoryLogger()); 
// defined in Proton
}


// public class defined in proton-api
public class CategoryLoggerWrapper implements EngineLogger, MessengerLogger...
{
    private static final JUL_CATEGEORY_LOGGER = new JulCategoryLogger()
        
        private CategoryLogger _categoryLogger = JUL_CATEGEORY_LOGGER // or use 
the logged defined in a system property if set
        
    static setDefaultCategoryLogger(logger);
   
    setCategoryLogger(logger)

    logFrameReceived(Connection, ....)
        {
                _categoryLogger.log(FRAME_CATEGORY, "blah blah")
        }
        
        logMessengerStuff(...)
}

// used by Python tests
public class RememberingLogger implements EngineLogger
{
   ... just remembers its invocations so we can assertion correct behaviour of 
ConnectionImpl
}


class EngineFactoryImpl
{
    public Connection createConnection()
    {
        conn = return new ConnectionImpl(_engineLogger);
    }
}
   
class SenderImpl
{
   ...
   getEngineLogger().logStuff(getConnection(), ....)
}
{code}
                  
> Add a pluggable Proton logging layer
> ------------------------------------
>
>                 Key: PROTON-343
>                 URL: https://issues.apache.org/jira/browse/PROTON-343
>             Project: Qpid Proton
>          Issue Type: Improvement
>          Components: proton-c, proton-j
>            Reporter: Philip Harvey
>            Assignee: Philip Harvey
>         Attachments: 
> 0001-PROTON-343-sketched-out-the-Java-parts-of-the-propos.patch
>
>
> Applications that use Proton sometimes want Proton to produce logging.
> Goals
> ====
> * Proton should provide a default logging implementation.
> * It should be easy for Proton client code to provide custom logging 
> implementation, e.g. one that uses the same third party logging framework as 
> their application code.
> * Proton should not have a compile-time dependency on a third party logging 
> framework
> * Proton's log output is considered to be part of its public interface.  
> Therefore, in the spirit of Proton's cross-language consistency goals, this 
> output should be consistent between proton-c and proton-j.
> * The goals that general-purpose logging frameworks try to meet - 
> performance, ease of use etc - also apply.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to