fix for BUG-947 - ErrorHandler classLoader issue
[openflowplugin.git] / openflowplugin / src / main / java / org / opendaylight / openflowplugin / openflow / md / core / ErrorHandlerSimpleImpl.java
1 /**
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.openflowplugin.openflow.md.core;
10
11 import java.util.Arrays;
12
13 import org.opendaylight.openflowplugin.openflow.md.core.session.SessionContext;
14 import org.slf4j.Logger;
15 import org.slf4j.LoggerFactory;
16
17 /**
18  * dumping all exceptions to log
19  * @author mirehak
20  */
21 public class ErrorHandlerSimpleImpl implements ErrorHandler {
22
23     private static final Logger LOG = LoggerFactory
24             .getLogger(ErrorHandlerSimpleImpl.class);
25
26     @Override
27     public void handleException(Throwable e, SessionContext sessionContext) {
28         String sessionKeyId = null;
29         if (sessionContext != null) {
30             sessionKeyId = Arrays.toString(sessionContext.getSessionKey().getId());
31         }
32         
33         LOG.error("exception -> {}, session -> {}", e.getMessage(), sessionKeyId, e);
34     }
35 }