You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Mahdi (JIRA)" <ji...@apache.org> on 2018/11/23 17:18:00 UTC

[jira] [Created] (AMQ-7111) ActiveMQ print multiple log on console

Mahdi created AMQ-7111:
--------------------------

             Summary: ActiveMQ print multiple log on console
                 Key: AMQ-7111
                 URL: https://issues.apache.org/jira/browse/AMQ-7111
             Project: ActiveMQ
          Issue Type: Bug
          Components: Broker
    Affects Versions: 5.15.8
            Reporter: Mahdi


Hello    .   

I write example authentication code for my own application .

but can not understand why logger wrote dual time logs on console .

this is my example test code :
{code:java}
import org.apache.activemq.broker.Broker;
import org.apache.activemq.broker.BrokerFilter;
import org.apache.activemq.broker.ConnectionContext;
import org.apache.activemq.command.ConnectionInfo;

import java.util.logging.Logger;

public class AuthenticationFilter extends BrokerFilter {
    private static final Logger logger = Logger.getLogger(AuthenticationFilter.class.getName());

    public AuthenticationFilter(Broker next) {
        super(next);
    }

    @Override
    public void addConnection(ConnectionContext context, ConnectionInfo info) throws Exception {
        String username = info.getUserName() ;
        String password = info.getPassword() ;
        if (username.equals("EXAMPLE_USER_NAME") && password.equals("EXAMPLE_PASSWORD")) {
            logger.info("Authentication Success .");
            super.addConnection(context, info);
        } else {
            logger.info("Authentication failed .");
            throw new SecurityException();
        }
    }
}

{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)