Skip to content

Commit

Permalink
Change log level on some messages from info to debug (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
bergander authored and emre-aydin committed Apr 25, 2018
1 parent 59cb2ab commit eb17b86
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 28 deletions.
Expand Up @@ -125,7 +125,7 @@ public void start() throws LifecycleException {
if (getMapName() == null || "default".equals(getMapName())) {
Context ctx = (Context) getContainer();
String contextPath = ctx.getServletContext().getContextPath();
log.info("contextPath:" + contextPath);
log.debug("contextPath: " + contextPath);
String mapName;
if (contextPath == null || contextPath.equals("/") || contextPath.equals("")) {
mapName = "empty_session_replication";
Expand Down Expand Up @@ -227,20 +227,20 @@ public void add(Session session) {

@Override
public Session findSession(String id) throws IOException {
log.info("sessionId:" + id);
log.debug("sessionId: " + id);
if (id == null) {
return null;
}

if (!isSticky() || (isSticky() && !sessions.containsKey(id))) {
if (isSticky()) {
log.info("Sticky Session is currently enabled."
+ "Some failover occured so reading session from Hazelcast map:" + getMapName());
log.debug("Sticky Session is currently enabled. "
+ "Some failover occurred so reading session from Hazelcast map: " + getMapName());
}

HazelcastSession hazelcastSession = sessionMap.get(id);
if (hazelcastSession == null) {
log.info("No Session found for:" + id);
log.debug("No Session found for: " + id);
return null;
}

Expand Down Expand Up @@ -292,7 +292,9 @@ public void commit(Session session) {
if (hazelcastSession.isDirty()) {
hazelcastSession.setDirty(false);
sessionMap.set(session.getId(), hazelcastSession);
log.info("Thread name:" + Thread.currentThread().getName() + " committed key:" + session.getId());
if (log.isDebugEnabled()) {
log.debug("Thread name: " + Thread.currentThread().getName() + " committed key: " + session.getId());
}
}
}

Expand Down
Expand Up @@ -101,7 +101,7 @@ public void startInternal() throws LifecycleException {
clientConfig.setClassLoader(getContainer().getLoader().getClassLoader());
instance = HazelcastClient.newHazelcastClient(clientConfig);
} catch (Exception e) {
log.error("Hazelcast Client could not be created. ", e);
log.error("Hazelcast Client could not be created.", e);
throw new LifecycleException(e.getMessage());
}
} else if (getHazelcastInstanceName() != null) {
Expand All @@ -112,7 +112,7 @@ public void startInternal() throws LifecycleException {
if (getMapName() == null || "default".equals(getMapName())) {
Context ctx = (Context) getContainer();
String contextPath = ctx.getServletContext().getContextPath();
log.info("contextPath:" + contextPath);
log.debug("contextPath: " + contextPath);
String mapName;
if (contextPath == null || contextPath.equals("/") || contextPath.equals("")) {
mapName = "empty_session_replication";
Expand Down Expand Up @@ -226,20 +226,20 @@ public void add(Session session) {

@Override
public Session findSession(String id) throws IOException {
log.debug("sessionId:" + id);
log.debug("sessionId: " + id);
if (id == null) {
return null;
}

if (!isSticky() || (isSticky() && !sessions.containsKey(id))) {
if (isSticky()) {
log.info("Sticky Session is currently enabled."
+ "Some failover occured so reading session from Hazelcast map:" + getMapName());
log.debug("Sticky Session is currently enabled. "
+ "Some failover occurred so reading session from Hazelcast map: " + getMapName());
}

HazelcastSession hazelcastSession = sessionMap.get(id);
if (hazelcastSession == null) {
log.info("No Session found for:" + id);
log.debug("No Session found for: " + id);
return null;
}

Expand Down Expand Up @@ -291,7 +291,9 @@ public void commit(Session session) {
if (hazelcastSession.isDirty()) {
hazelcastSession.setDirty(false);
sessionMap.set(session.getId(), hazelcastSession);
log.info("Thread name:" + Thread.currentThread().getName() + " committed key:" + session.getId());
if (log.isDebugEnabled()) {
log.debug("Thread name: " + Thread.currentThread().getName() + " committed key: " + session.getId());
}
}
}

Expand Down
Expand Up @@ -99,7 +99,7 @@ public void startInternal() throws LifecycleException {
clientConfig.setClassLoader(getContext().getLoader().getClassLoader());
instance = HazelcastClient.newHazelcastClient(clientConfig);
} catch (Exception e) {
log.error("Hazelcast Client could not be created. ", e);
log.error("Hazelcast Client could not be created.", e);
throw new LifecycleException(e.getMessage());
}
} else if (getHazelcastInstanceName() != null) {
Expand All @@ -110,7 +110,7 @@ public void startInternal() throws LifecycleException {
if (getMapName() == null || "default".equals(getMapName())) {
Context ctx = getContext();
String contextPath = ctx.getServletContext().getContextPath();
log.info("contextPath:" + contextPath);
log.debug("contextPath: " + contextPath);
String mapName;
if (contextPath == null || contextPath.equals("/") || contextPath.equals("")) {
mapName = "empty_session_replication";
Expand Down Expand Up @@ -224,20 +224,20 @@ public void add(Session session) {

@Override
public Session findSession(String id) throws IOException {
log.debug("sessionId:" + id);
log.debug("sessionId: " + id);
if (id == null) {
return null;
}

if (!isSticky() || (isSticky() && !sessions.containsKey(id))) {
if (isSticky()) {
log.info("Sticky Session is currently enabled."
+ "Some failover occured so reading session from Hazelcast map:" + getMapName());
log.debug("Sticky Session is currently enabled. "
+ "Some failover occurred so reading session from Hazelcast map: " + getMapName());
}

HazelcastSession hazelcastSession = sessionMap.get(id);
if (hazelcastSession == null) {
log.info("No Session found for:" + id);
log.debug("No Session found for: " + id);
return null;
}

Expand Down Expand Up @@ -288,7 +288,9 @@ public void commit(Session session) {
if (hazelcastSession.isDirty()) {
hazelcastSession.setDirty(false);
sessionMap.set(session.getId(), hazelcastSession);
log.info("Thread name:" + Thread.currentThread().getName() + " committed key:" + session.getId());
if (log.isDebugEnabled()) {
log.debug("Thread name: " + Thread.currentThread().getName() + " committed key: " + session.getId());
}
}
}

Expand Down
Expand Up @@ -82,7 +82,7 @@ public void startInternal() throws LifecycleException {
clientConfig.setClassLoader(getContext().getLoader().getClassLoader());
instance = HazelcastClient.newHazelcastClient(clientConfig);
} catch (Exception e) {
log.error("Hazelcast Client could not be created. ", e);
log.error("Hazelcast Client could not be created.", e);
throw new LifecycleException(e.getMessage());
}
} else if (getHazelcastInstanceName() != null) {
Expand All @@ -93,7 +93,7 @@ public void startInternal() throws LifecycleException {
if (getMapName() == null || "default".equals(getMapName())) {
Context ctx = getContext();
String contextPath = ctx.getServletContext().getContextPath();
log.info("contextPath:" + contextPath);
log.debug("contextPath: " + contextPath);
if (contextPath == null || contextPath.equals("/") || contextPath.equals("")) {
mapName = "empty_session_replication";
} else {
Expand Down Expand Up @@ -206,24 +206,25 @@ public void add(Session session) {

@Override
public Session findSession(String id) throws IOException {
log.debug("Attempting to find sessionId:" + id);
log.debug("Attempting to find sessionId: " + id);

if (id == null) {
return null;
}

if (!isSticky() || (isSticky() && !sessions.containsKey(id))) {
if (isSticky()) {
log.info("Sticky Session is currently enabled."
+ "Some failover occured so reading session from Hazelcast map:" + getMapName());
log.debug("Sticky Session is currently enabled. "
+ "Some failover occurred so reading session from Hazelcast map: " + getMapName());
}

HazelcastSession hazelcastSession = sessionMap.get(id);
if (hazelcastSession == null) {
log.info("No Session found for:" + id);
log.debug("No Session found for: " + id);
return null;
}

log.info("Session found for:" + id);
log.debug("Session found for: " + id);

hazelcastSession.access();
hazelcastSession.endAccess();
Expand Down Expand Up @@ -272,7 +273,9 @@ public void commit(Session session) {
if (hazelcastSession.isDirty()) {
hazelcastSession.setDirty(false);
sessionMap.set(session.getId(), hazelcastSession);
log.info("Thread name:" + Thread.currentThread().getName() + " committed key:" + session.getId());
if (log.isDebugEnabled()) {
log.debug("Thread name: " + Thread.currentThread().getName() + " committed key: " + session.getId());
}
}
}

Expand Down

0 comments on commit eb17b86

Please sign in to comment.