Skip to content

Commit

Permalink
Merge pull request #4031 from wso2/revert-4028-correlation-logs
Browse files Browse the repository at this point in the history
Revert "Include Correlation ID, LDAP, and JDBC logs when correlation logs are enabled with management API"
  • Loading branch information
arunans23 authored Feb 18, 2025
2 parents ead59fb + f9f0840 commit a592a68
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,11 @@
import org.apache.commons.logging.LogFactory;
import org.apache.synapse.MessageContext;
import org.apache.synapse.commons.json.JsonUtil;
import org.apache.synapse.commons.logger.ContextAwareLogger;
import org.apache.synapse.config.SynapseConfiguration;
import org.apache.synapse.transport.passthru.config.PassThroughCorrelationConfigDataHolder;
import org.json.JSONObject;
import org.wso2.micro.integrator.management.apis.security.handler.SecurityUtils;
import org.wso2.micro.integrator.ndatasource.rdbms.CorrelationLogInterceptor;
import org.wso2.micro.integrator.security.user.api.UserStoreException;
import org.wso2.micro.integrator.security.user.core.ldap.LDAPConnectionContext;

import java.io.IOException;
import java.util.HashSet;
Expand Down Expand Up @@ -130,10 +127,6 @@ private JSONObject handlePut(org.apache.axis2.context.MessageContext axis2Messag
}
boolean enabled = Boolean.parseBoolean(configs.get(ENABLED).getAsString());
PassThroughCorrelationConfigDataHolder.setEnable(enabled);
ContextAwareLogger.setCorrelationLoggingEnabled(enabled);
LDAPConnectionContext.setCorrelationLoggingEnabled(enabled);
CorrelationLogInterceptor.setCorrelationLoggingEnabled(enabled);

JSONObject response = new JSONObject();
response.put(Constants.MESSAGE, "Successfully Updated Correlation Logs Status");
return response;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public class CorrelationLogInterceptor extends AbstractQueryReport {
private static final String BLACKLISTED_THREADS_SYSTEM_PROPERTY =
"org.wso2.CorrelationLogInterceptor.BlacklistedThreads";
private static final String DEFAULT_BLACKLISTED_THREAD = "MessageDeliveryTaskThreadPool";
private static boolean correlationLoggingEnabled = false;
private List<String> blacklistedThreadList = new ArrayList<>();

public CorrelationLogInterceptor() {
Expand Down Expand Up @@ -125,7 +124,7 @@ protected void prepareCall(String s, long l) {
public Object createStatement(Object proxy, Method method, Object[] args, Object statement, long time) {

try {
if (Boolean.parseBoolean(System.getProperty(CORRELATION_LOG_SYSTEM_PROPERTY)) || correlationLoggingEnabled) {
if (Boolean.parseBoolean(System.getProperty(CORRELATION_LOG_SYSTEM_PROPERTY))) {
return invokeProxy(method, args, statement, time);
} else {
return statement;
Expand Down Expand Up @@ -285,8 +284,4 @@ private String createFormattedLog(List<String> logPropertiesList) {
return sb.toString();
}
}
public static void setCorrelationLoggingEnabled(boolean correlationLoggingEnabled) {

CorrelationLogInterceptor.correlationLoggingEnabled = correlationLoggingEnabled;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ public class LDAPConnectionContext {
private static final int CORRELATION_LOG_INITIALIZATION_ARGS_LENGTH = 0;
private static final String CORRELATION_LOG_SEPARATOR = "|";
private static final String CORRELATION_LOG_SYSTEM_PROPERTY = "enableCorrelationLogs";
private static boolean correlationLoggingEnabled = false;
public static final String CIRCUIT_STATE_OPEN = "open";
public static final String CIRCUIT_STATE_CLOSE = "close";

Expand Down Expand Up @@ -626,7 +625,7 @@ private LdapContext getContextForEnvironmentVariables(Hashtable<?, ?> environmen
*/
private DirContext getDirContext(Hashtable<?, ?> environment) throws NamingException {

if (Boolean.parseBoolean(System.getProperty(CORRELATION_LOG_SYSTEM_PROPERTY)) || correlationLoggingEnabled) {
if (Boolean.parseBoolean(System.getProperty(CORRELATION_LOG_SYSTEM_PROPERTY))) {
final Class[] proxyInterfaces = new Class[]{DirContext.class};
long start = System.currentTimeMillis();

Expand Down Expand Up @@ -663,7 +662,7 @@ private DirContext getDirContext(Hashtable<?, ?> environment) throws NamingExcep
private LdapContext getLdapContext(Hashtable<?, ?> environment, Control[] connectionControls)
throws NamingException, UserStoreException {

if (Boolean.parseBoolean(System.getProperty(CORRELATION_LOG_SYSTEM_PROPERTY)) || correlationLoggingEnabled) {
if (Boolean.parseBoolean(System.getProperty(CORRELATION_LOG_SYSTEM_PROPERTY))) {
final Class[] proxyInterfaces = new Class[]{LdapContext.class};
long start = System.currentTimeMillis();

Expand Down Expand Up @@ -841,8 +840,4 @@ private long getThresholdTimeoutInMilliseconds(String retryWaitingTime) throws U
+ UserStoreConfigConstants.CONNECTION_RETRY_DELAY);
}
}
public static void setCorrelationLoggingEnabled(boolean correlationLoggingEnabled) {

LDAPConnectionContext.correlationLoggingEnabled = correlationLoggingEnabled;
}
}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1622,7 +1622,7 @@
<version.jaxb.api>2.4.0-b180830.0359</version.jaxb.api>
<com.sun.jaxb.version>2.3.0</com.sun.jaxb.version>
<com.sun.jaxb.impl.version>2.3.1</com.sun.jaxb.impl.version>
<synapse.version>4.0.0-wso2v216</synapse.version>
<synapse.version>4.0.0-wso2v215</synapse.version>
<imp.pkg.version.synapse>[4.0.0, 4.0.1)</imp.pkg.version.synapse>
<carbon.mediation.version>4.7.244</carbon.mediation.version>
<carbon.crypto.version>1.1.3</carbon.crypto.version>
Expand Down

0 comments on commit a592a68

Please sign in to comment.