Skip to content

Commit

Permalink
Merge branch 'dtq-dev' into internal/added-more-logs-to-context
Browse files Browse the repository at this point in the history
  • Loading branch information
milanmajchrak authored Dec 17, 2024
2 parents 6f25873 + 85a9090 commit a3a6dff
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
10 changes: 9 additions & 1 deletion dspace-api/src/main/java/org/dspace/core/Context.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ public Context(Mode mode) {
*/
protected void init() {
try {
log.info("Initializing new context, mode: {}", mode);
updateDatabase();

if (eventService == null) {
Expand Down Expand Up @@ -396,6 +397,8 @@ public String getExtraLogInfo() {
* or closing the connection
*/
public void complete() throws SQLException {
log.info("Completing context.");
// If Context is no longer open/valid, just note that it has already been closed
if (!isValid()) {
log.info("complete() was called on a closed Context object. No changes to commit.");
return;
Expand All @@ -409,10 +412,12 @@ public void complete() throws SQLException {
log.error("Error committing transaction in complete()", e);
throw e; // Rethrow to signal failure to higher-level logic
} finally {
log.info("Going to close a connection.");
if (dbConnection != null) {
try {
log.info("Closing connection.");
dbConnection.closeDBConnection();
log.info("Database connection closed after complete().");
log.info("Connection closed.");
dbConnection = null;
} catch (SQLException ex) {
log.error("Error closing the database connection after complete()", ex);
Expand Down Expand Up @@ -595,6 +600,7 @@ public void rollback() throws SQLException {
* is a no-op.
*/
public void abort() {
log.info("Aborting context.");
// If Context is no longer open/valid, just note that it has already been closed
if (!isValid()) {
log.info("abort() was called on a closed Context object. No changes to abort.");
Expand All @@ -611,7 +617,9 @@ public void abort() {
log.error("Error rolling back transaction during an abort()", se);
} finally {
try {
log.info("Going to close a connection.");
if (dbConnection != null) {
log.info("Closing connection.");
// Free the DB connection & invalidate the Context
dbConnection.closeDBConnection();
log.info("Database connection closed during abort().");
Expand Down
4 changes: 3 additions & 1 deletion dspace-api/src/main/java/org/dspace/eperson/EPerson.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.Logger;
import org.dspace.content.DSpaceObject;
import org.dspace.content.DSpaceObjectLegacySupport;
import org.dspace.content.Item;
Expand All @@ -43,6 +44,7 @@
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, include = "non-lazy")
@Table(name = "eperson")
public class EPerson extends DSpaceObject implements DSpaceObjectLegacySupport {
private static final Logger log = org.apache.logging.log4j.LogManager.getLogger(EPerson.class);
@Column(name = "eperson_id", insertable = false, updatable = false)
private Integer legacyId;

Expand Down Expand Up @@ -122,7 +124,7 @@ public class EPerson extends DSpaceObject implements DSpaceObjectLegacySupport {
* {@link org.dspace.eperson.service.EPersonService#create(Context)}
*/
protected EPerson() {

log.info("EPerson created");
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion dspace/config/log4j2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<!-- NOTE: The %equals patterns are providing a default value of "unknown" if "correlationID" or
"requestID" are not currently set in the ThreadContext. -->
<Layout type='PatternLayout'
pattern='%d %-5p %equals{%X{correlationID}}{}{unknown} %equals{%X{requestID}}{}{unknown} %c @ %m%n'/>
pattern='%d %t %-5p %equals{%X{correlationID}}{}{unknown} %equals{%X{requestID}}{}{unknown} %c @ %m%n'/>
<policies>
<policy type='TimeBasedTriggeringPolicy'>yyyy-MM-dd</policy>
</policies>
Expand Down
2 changes: 1 addition & 1 deletion dspace/config/modules/authentication.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jwt.login.encryption.enabled = false
jwt.login.compression.enabled = true

# Expiration time of a token in milliseconds
jwt.login.token.expiration = 1800000
jwt.login.token.expiration = 24000

#---------------------------------------------------------------#
#---Stateless JWT Authentication for downloads of bitstreams----#
Expand Down

0 comments on commit a3a6dff

Please sign in to comment.