Skip to content

Commit df03c10

Browse files
committed
Change some logs to trace
1 parent df33d7b commit df03c10

File tree

4 files changed

+51
-14
lines changed

4 files changed

+51
-14
lines changed

orcid-web/src/main/java/org/orcid/frontend/spring/session/redis/OrcidEnableRedisHttpSession.java

+11
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@
99

1010
import java.lang.annotation.*;
1111

12+
/**
13+
* This code is an adaptation from the original Spring Session Data Redis (https://spring.io/projects/spring-session,
14+
* source code https://github.com/spring-projects/spring-session/tree/main/spring-session-data-redis)
15+
* And has been modified to meet ORCID requirements.
16+
*
17+
* Licensed under the Apache License, Version 2.0 (the "License");
18+
* you may not use this file except in compliance with the License.
19+
* You may obtain a copy of the License at
20+
*
21+
* https://www.apache.org/licenses/LICENSE-2.0
22+
* */
1223
@Retention(RetentionPolicy.RUNTIME)
1324
@Target({ElementType.TYPE})
1425
@Documented

orcid-web/src/main/java/org/orcid/frontend/spring/session/redis/OrcidRedisHttpSessionConfiguration.java

+11
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,17 @@
5454
import java.util.concurrent.Executor;
5555
import java.util.stream.Collectors;
5656

57+
/**
58+
* This code is an adaptation from the original Spring Session Data Redis (https://spring.io/projects/spring-session,
59+
* source code https://github.com/spring-projects/spring-session/tree/main/spring-session-data-redis)
60+
* And has been modified to meet ORCID requirements.
61+
*
62+
* Licensed under the Apache License, Version 2.0 (the "License");
63+
* you may not use this file except in compliance with the License.
64+
* You may obtain a copy of the License at
65+
*
66+
* https://www.apache.org/licenses/LICENSE-2.0
67+
* */
5768
@Configuration(
5869
proxyBeanMethods = false
5970
)

orcid-web/src/main/java/org/orcid/frontend/spring/session/redis/OrcidRedisIndexedSessionRepository.java

+18-14
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,17 @@
2929
import java.time.Instant;
3030
import java.util.*;
3131

32+
/**
33+
* This code is an adaptation from the original Spring Session Data Redis (https://spring.io/projects/spring-session,
34+
* source code https://github.com/spring-projects/spring-session/tree/main/spring-session-data-redis)
35+
* And has been modified to meet ORCID requirements.
36+
*
37+
* Licensed under the Apache License, Version 2.0 (the "License");
38+
* you may not use this file except in compliance with the License.
39+
* You may obtain a copy of the License at
40+
*
41+
* https://www.apache.org/licenses/LICENSE-2.0
42+
* */
3243
public class OrcidRedisIndexedSessionRepository implements FindByIndexNameSessionRepository<OrcidRedisIndexedSessionRepository.RedisSession>, MessageListener {
3344
private static final Log logger = LogFactory.getLog(OrcidRedisIndexedSessionRepository.class);
3445
private static final String SPRING_SECURITY_CONTEXT = "SPRING_SECURITY_CONTEXT";
@@ -127,13 +138,10 @@ public RedisOperations<Object, Object> getSessionRedisOperations() {
127138
}
128139

129140
public void save(OrcidRedisIndexedSessionRepository.RedisSession session) {
130-
// TODO: REMOVE ALL THIS BEFORE GOING LIVE!!!
131141
ServletRequestAttributes att = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
132142
HttpServletRequest request = att.getRequest();
133-
///////////////////////////////////////////////
134143

135144
if(updateSession()) {
136-
//TODO: REMOVE THIS LOG ENTRY BEFORE GOING LIVE!!!!
137145
logger.debug("Saving session for " + request.getRequestURI() + " - " + request.getMethod());
138146
session.save();
139147
if (session.isNew) {
@@ -142,8 +150,7 @@ public void save(OrcidRedisIndexedSessionRepository.RedisSession session) {
142150
session.isNew = false;
143151
}
144152
} else {
145-
//TODO: REMOVE THIS LOG ENTRY BEFORE GOING LIVE!!!!
146-
logger.debug("Skip save session id " + request.getRequestURI() + " - " + request.getMethod());
153+
logger.trace("Skip save session id " + request.getRequestURI() + " - " + request.getMethod());
147154
}
148155
}
149156

@@ -204,17 +211,13 @@ private MapSession loadSession(String id, Map<Object, Object> entries) {
204211
} else if ("maxInactiveInterval".equals(key)) {
205212
loaded.setMaxInactiveInterval(Duration.ofSeconds((long)(Integer)entry.getValue()));
206213
} else if ("lastAccessedTime".equals(key)) {
207-
// TODO: REMOVE ALL THIS BEFORE GOING LIVE!!!
208214
ServletRequestAttributes att = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
209215
HttpServletRequest request = att.getRequest();
210-
///////////////////////////////////////////////
211216
if(updateSession()) {
212-
// TODO: REMOVE THIS LOG ENTRY BEFORE GOING LIVE!!!
213217
logger.debug("Updating last accessed time for " + request.getRequestURI() + " - " + request.getMethod());
214218
loaded.setLastAccessedTime(Instant.ofEpochMilli((Long) entry.getValue()));
215219
} else {
216-
// TODO: REMOVE THIS LOG ENTRY BEFORE GOING LIVE!!!
217-
logger.debug("Ignoring last accessed time for " + request.getRequestURI() + " - " + request.getMethod());
220+
logger.trace("Ignoring last accessed time for " + request.getRequestURI() + " - " + request.getMethod());
218221
}
219222
} else if (key.startsWith("sessionAttr:")) {
220223
loaded.setAttribute(key.substring("sessionAttr:".length()), entry.getValue());
@@ -417,15 +420,16 @@ final class RedisSession implements Session {
417420

418421
public void setLastAccessedTime(Instant lastAccessedTime) {
419422
if(updateSession()) {
420-
// TODO: REMOVE THIS BEFORE GOING LIVE!!!!
421423
ServletRequestAttributes att = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
422424
HttpServletRequest request = att.getRequest();
423-
logger.debug("REDIS_SESSION: setLastAccessedTime: " + request.getRequestURI().toString() + " - " + request.getMethod());
424-
///////////////////////////////////////////
425-
425+
logger.debug("Set last accessed time for REDIS_SESSION: " + request.getRequestURI().toString() + " - " + request.getMethod());
426426
this.cached.setLastAccessedTime(lastAccessedTime);
427427
this.delta.put("lastAccessedTime", this.getLastAccessedTime().toEpochMilli());
428428
this.flushImmediateIfNecessary();
429+
} else {
430+
ServletRequestAttributes att = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
431+
HttpServletRequest request = att.getRequest();
432+
logger.trace("Set last accessed time for REDIS_SESSION: " + request.getRequestURI().toString() + " - " + request.getMethod());
429433
}
430434
}
431435

orcid-web/src/main/java/org/orcid/frontend/spring/session/redis/OrcidRedisSessionExpirationPolicy.java

+11
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@
1313
import java.util.concurrent.TimeUnit;
1414
import java.util.function.Function;
1515

16+
/**
17+
* This code is an adaptation from the original Spring Session Data Redis (https://spring.io/projects/spring-session,
18+
* source code https://github.com/spring-projects/spring-session/tree/main/spring-session-data-redis)
19+
* And has been modified to meet ORCID requirements.
20+
*
21+
* Licensed under the Apache License, Version 2.0 (the "License");
22+
* you may not use this file except in compliance with the License.
23+
* You may obtain a copy of the License at
24+
*
25+
* https://www.apache.org/licenses/LICENSE-2.0
26+
* */
1627
public class OrcidRedisSessionExpirationPolicy {
1728
private static final Log logger = LogFactory.getLog(OrcidRedisSessionExpirationPolicy.class);
1829
private static final String SESSION_EXPIRES_PREFIX = "expires:";

0 commit comments

Comments
 (0)