diff --git a/dspace-api/src/main/java/org/dspace/core/Context.java b/dspace-api/src/main/java/org/dspace/core/Context.java index 80f443126816..b9b092bcfb31 100644 --- a/dspace-api/src/main/java/org/dspace/core/Context.java +++ b/dspace-api/src/main/java/org/dspace/core/Context.java @@ -170,6 +170,7 @@ public Context(Mode mode) { */ protected void init() { try { + log.info("Initializing new context, mode: {}", mode); updateDatabase(); if (eventService == null) { @@ -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; @@ -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); @@ -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."); @@ -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()."); diff --git a/dspace-api/src/main/java/org/dspace/eperson/EPerson.java b/dspace-api/src/main/java/org/dspace/eperson/EPerson.java index 3244a25018f7..3466b7a4dcda 100644 --- a/dspace-api/src/main/java/org/dspace/eperson/EPerson.java +++ b/dspace-api/src/main/java/org/dspace/eperson/EPerson.java @@ -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; @@ -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; @@ -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 diff --git a/dspace/config/log4j2.xml b/dspace/config/log4j2.xml index a21cef9d6f3e..ef54dd66a1e2 100644 --- a/dspace/config/log4j2.xml +++ b/dspace/config/log4j2.xml @@ -31,7 +31,7 @@ + pattern='%d %t %-5p %equals{%X{correlationID}}{}{unknown} %equals{%X{requestID}}{}{unknown} %c @ %m%n'/> yyyy-MM-dd diff --git a/dspace/config/modules/authentication.cfg b/dspace/config/modules/authentication.cfg index 451cdbbbf7bb..cd6df7e5da38 100644 --- a/dspace/config/modules/authentication.cfg +++ b/dspace/config/modules/authentication.cfg @@ -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----#