Ignore:
Timestamp:
06/19/13 15:59:53 (11 years ago)
Author:
stoda
Message:

log4j added

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/main/java/omq/common/util/OmqConnectionFactory.java

    r44 r49  
    55import java.security.NoSuchAlgorithmException;
    66import java.util.Properties;
     7
     8import org.apache.log4j.Logger;
    79
    810import com.rabbitmq.client.Channel;
     
    1618 */
    1719public class OmqConnectionFactory {
     20        private static final Logger logger = Logger.getLogger(OmqConnectionFactory.class.getName());
     21
    1822        private static Connection connection;
    1923        private static int connectionTimeout = 2 * 1000;
     
    3438                                working = true;
    3539                        } catch (Exception e) {
    36                                 e.printStackTrace();
     40                                logger.error(e);
    3741                                long milis = Long.parseLong(env.getProperty(ParameterQueue.RETRY_TIME_CONNECTION, "2000"));
    3842                                Thread.sleep(milis);
     
    6468                        factory.useSslProtocol();
    6569                }
    66                 return factory.newConnection();
     70
     71                Connection connection = factory.newConnection();
     72                logger.info("New connection created using: username: " + username + ", host: " + host + ", port: " + port + ", connection timeout: "
     73                                + connectionTimeout + " SSL enabled: " + ssl);
     74                return connection;
    6775        }
    6876
    6977        public static Channel getNewChannel() throws IOException {
    70                 return connection.createChannel();
     78                Channel channel = connection.createChannel();
     79                logger.info("New channel created using the default connection");
     80                return channel;
    7181        }
    7282}
Note: See TracChangeset for help on using the changeset viewer.