Skip to content

Commit

Permalink
# This is a combination of 4 commits.
Browse files Browse the repository at this point in the history
# This is the 1st commit message:

CXF Original

# This is the commit message OpenLiberty#2:

Traces are added

# This is the commit message OpenLiberty#3:

Remove FAT bundle changes

# This is the commit message OpenLiberty#4:

WIP
  • Loading branch information
BerksanAtes committed Jun 13, 2024
1 parent a113451 commit 68471f1
Show file tree
Hide file tree
Showing 42 changed files with 2,945 additions and 205 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,10 @@
*******************************************************************************/
package com.ibm.ws.jaxws.fat;

import org.junit.ClassRule;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;

import componenttest.rules.repeater.EmptyAction;
import componenttest.rules.repeater.FeatureReplacementAction;
import componenttest.rules.repeater.RepeatTests;

/*
* TODO: Lite Mode
*/
Expand Down Expand Up @@ -47,6 +42,6 @@
})
public class FATSuite {

@ClassRule
public static RepeatTests r = RepeatTests.with(new EmptyAction().fullFATOnly()).andWith(FeatureReplacementAction.EE9_FEATURES().removeFeature("jaxwstest-2.2").addFeature("xmlwstest-3.0").conditionalFullFATOnly(FeatureReplacementAction.GREATER_THAN_OR_EQUAL_JAVA_11)).andWith(FeatureReplacementAction.EE10_FEATURES().removeFeature("jaxwstest-2.2").removeFeature("xmlwstest-3.0").addFeature("xmlwstest-4.0"));
// @ClassRule
// public static RepeatTests r = RepeatTests.with(new EmptyAction().fullFATOnly()).andWith(FeatureReplacementAction.EE9_FEATURES().removeFeature("jaxwstest-2.2").addFeature("xmlwstest-3.0").conditionalFullFATOnly(FeatureReplacementAction.GREATER_THAN_OR_EQUAL_JAVA_11)).andWith(FeatureReplacementAction.EE10_FEATURES().removeFeature("jaxwstest-2.2").removeFeature("xmlwstest-3.0").addFeature("xmlwstest-4.0"));
}
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
bootstrap.include=../testports.properties
bootstrap.include=../testports.properties
com.ibm.ws.logging.trace.specification=org.apache.cxf.*=all=enabled
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
bootstrap.include=../testports.properties
bootstrap.include=../testports.properties
com.ibm.ws.logging.trace.specification=org.apache.cxf.*=all=enabled
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
bootstrap.include=../testports.properties
bootstrap.include=../testports.properties
com.ibm.ws.logging.trace.specification=org.apache.cxf.*=all=enabled
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
bootstrap.include=../testports.properties
bootstrap.include=../testports.properties
com.ibm.ws.logging.trace.specification=org.apache.cxf.*=all=enabled
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
bootstrap.include=../testports.properties
bootstrap.include=../testports.properties
com.ibm.ws.logging.trace.specification=org.apache.cxf.*=all=enabled
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
bootstrap.include=../testports.properties
bootstrap.include=../testports.properties
com.ibm.ws.logging.trace.specification=org.apache.cxf.*=all=enabled
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
bootstrap.include=../testports.properties
bootstrap.include=../testports.properties
com.ibm.ws.logging.trace.specification=org.apache.cxf.*=all=enabled
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
bootstrap.include=../testports.properties
bootstrap.include=../testports.properties
com.ibm.ws.logging.trace.specification=org.apache.cxf.*=all=enabled
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
bootstrap.include=../testports.properties
bootstrap.include=../testports.properties
com.ibm.ws.logging.trace.specification=org.apache.cxf.*=all=enabled
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
bootstrap.include=../testports.properties
# Please do not remove the trace below! This is required to check PropertySettingsTest test
com.ibm.ws.logging.trace.specification=*=info=enabled:LogService=all:com.ibm.ws.jaxws.utils.*=all:org.apache.cxf.ws.policy=fine:org.apache.cxf.jaxws.interceptors=fine
com.ibm.ws.logging.trace.specification=*=info=enabled:LogService=all:com.ibm.ws.jaxws.utils.*=all:org.apache.cxf.ws.policy=fine:org.apache.cxf.jaxws.interceptors=fine:org.apache.cxf.*=all=enabled
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
bootstrap.include=../testports.properties
# Please do not remove the trace below! This is required to check PropertySettingsTest test
com.ibm.ws.logging.trace.specification=*=info=enabled:LogService=all:org.apache.cxf.ws.policy=fine:org.apache.cxf.jaxws.*=fine
com.ibm.ws.logging.trace.specification=*=info=enabled:LogService=all:org.apache.cxf.ws.policy=fine:org.apache.cxf.jaxws.*=fine:org.apache.cxf.*=all=enabled
cxf.multipart.attachment=false
cxf.ignore.unsupported.policy=true
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
bootstrap.include=../testports.properties
bootstrap.include=../testports.properties
com.ibm.ws.logging.trace.specification=org.apache.cxf.*=all=enabled
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
bootstrap.include=../testports.properties
bootstrap.include=../testports.properties
com.ibm.ws.logging.trace.specification=org.apache.cxf.*=all=enabled
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
bootstrap.include=../testports.properties
bootstrap.include=../testports.properties
com.ibm.ws.logging.trace.specification=org.apache.cxf.*=all=enabled
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
bootstrap.include=../testports.properties
bootstrap.include=../testports.properties
com.ibm.ws.logging.trace.specification=org.apache.cxf.*=all=enabled
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
bootstrap.include=../testports.properties
bootstrap.include=../testports.properties
com.ibm.ws.logging.trace.specification=org.apache.cxf.*=all=enabled
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
bootstrap.include=../testports.properties
bootstrap.include=../testports.properties
com.ibm.ws.logging.trace.specification=org.apache.cxf.*=all=enabled
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
bootstrap.include=../testports.properties
bootstrap.include=../testports.properties
com.ibm.ws.logging.trace.specification=org.apache.cxf.*=all=enabled
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
bootstrap.include=../testports.properties
bootstrap.include=../testports.properties
com.ibm.ws.logging.trace.specification=org.apache.cxf.*=all=enabled
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
bootstrap.include=../testports.properties
bootstrap.include=../testports.properties
com.ibm.ws.logging.trace.specification=org.apache.cxf.*=all=enabled:java.util.*=all
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
websphere.java.security.exempt=true
bootstrap.include=../testports.properties
com.ibm.ws.logging.trace.specification=org.apache.cxf.*=all=enabled
3 changes: 2 additions & 1 deletion dev/com.ibm.ws.jaxws.wsat/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,6 @@ Service-Component: \
com.ibm.ws.org.apache.neethi.3.1.1;version=latest,\
com.ibm.websphere.org.osgi.core;version=latest,\
com.ibm.websphere.org.osgi.service.component;version=latest, \
com.ibm.ws.org.osgi.annotation.versioning;version=latest
com.ibm.ws.org.osgi.annotation.versioning;version=latest \
com.ibm.ws.logging.core;version=latest

5 changes: 4 additions & 1 deletion dev/com.ibm.ws.org.apache.cxf.cxf.core.3.2/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ Export-Package: \
org.apache.cxf.ws.addressing.wsdl;version=${exportVer}, \
org.apache.cxf.wsdl.http;version=${exportVer}, \
com.ibm.ws.cxf.client;version=${exportVer}, \
com.ibm.ws.cxf.client.component;version=${exportVer}
com.ibm.ws.cxf.client.component;version=${exportVer}, \
io.openliberty.cxf.logging;version=${exportVer}

DynamicImport-Package: \
com.ctc.wstx.*, \
Expand All @@ -169,6 +170,8 @@ instrument.classesExcludes: \
org/apache/cxf/interceptor/*.class, \
org/apache/cxf/service/model/*.class, \
org/apache/cxf/staxutils/*.class
org/apache/cxf/common/logging/*.class, \
io/openliberty/cxf/logging/*.class

-buildpath: \
javax.activation:activation;version=1.1, \
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
/*******************************************************************************
* Copyright (c) 2024 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package io.openliberty.cxf.logging;

import java.util.logging.ConsoleHandler;
import java.util.logging.Filter;
import java.util.logging.Handler;
import java.util.logging.LogManager;
import java.util.logging.LogRecord;
import java.util.logging.Logger;

import com.ibm.websphere.ras.annotation.Trivial;
import com.ibm.ws.logging.internal.WsLogger;

/**
* CXFLogger is inherited from the WsLogger class to preserve same behavior
* except the one that we aimed to change. Which is to add class name to log records.
* The whole design is aimed to support the addition of class name to the logRecord
* in public void log(LogRecord logRecord) method in line logRecord.setSourceClassName(getClassName());
*/
public class CXFLogger extends WsLogger {

private String className = "";

/**
* @param name
* @param resourceBundleName
* @param c
*/
public CXFLogger(String name, String resourceBundleName, Class<?> c) {
super(name, c, resourceBundleName);
setClassName(c.getCanonicalName());
}

/**
* @return the className
*/
public String getClassName() {
return this.className;
}

/**
* @param className the className to set
*/
public void setClassName(String clsName) {
this.className = clsName;
}

/*
* @see java.util.logging.Logger#log(java.util.logging.LogRecord)
*/
@Trivial
@Override
public void log(LogRecord logRecord) {
if (logRecord == null) {
return;
}
// The whole point this task is to
// add the class name to the logRecord
logRecord.setSourceClassName(getClassName());
// super.log(logRecord);
if (!isLoggable(logRecord.getLevel())) {
System.out.println("#in CXFLogger return 1");
return;
}
Filter theFilter = getFilter();;
if (theFilter != null && !theFilter.isLoggable(logRecord)) {
System.out.println("#in CXFLogger return 2");
return;
}

// Post the LogRecord to all our Handlers, and then to
// our parents' handlers, all the way up the tree.
Logger logger = this;

Logger.getGlobal().addHandler(new ConsoleHandler());

while (logger != null) {
final Handler[] loggerHandlers = logger.getGlobal().getHandlers();
System.out.println("#in CXFLogger loggerHandlers: " + loggerHandlers);
for (Handler handler : loggerHandlers) {
handler.publish(logRecord);
System.out.println("#in CXFLogger handler.publish(logRecord): " + handler);
}

final boolean useParentHdls = getUseParentHandlers();

if (!useParentHdls) {
System.out.println("#in CXFLogger break");
break;
}

logger = logger.getParent();
}
}

/**
* @param loggerName
* @param bundleName
* @param cls
* @return
*/
public static CXFLogger getLogger(String loggerName, String bundleName, Class<?> cls) {
return new CXFLogger(loggerName, bundleName, cls);
}

/**
* @param loggerName
* @param cls
* @return
*/
public static CXFLogger getLogger(String loggerName, Class<?> cls) {
return getLogger(loggerName, null, cls);
}

/**
* @param logger
* @param cls
* @return
*/
public static Logger getLogger(Logger logger, Class<?> cls) {
return getLogger(logger.getName(), logger.getResourceBundleName(), cls);
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*******************************************************************************
* Copyright (c) 2024 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package org.apache.cxf.common.logging;

import java.util.logging.LogRecord;
import com.ibm.ws.logging.internal.WsLogger;

/**
* CXFLogger is inherited from the WsLogger class to preserve same behavior
* except the one that we aimed to change. Which is to add class name to log records
*/
public class CXFLogger extends WsLogger {

private String className = "";

/**
* @param name
* @param c
* @param resourceBundleName
*/
public CXFLogger(String name, String resourceBundleName, Class<?> c) {
super(name, c, resourceBundleName);
setClassName(c.getCanonicalName());
}

/**
* This method is not aimed to use since due to trace injection
* it creates significant amount of excessive logs
* this.className will be used instead
*
* @return the className
*/
public String getClassName() {
return this.className;
}

/**
* @param className the className to set
*/
public void setClassName(String clsName) {
this.className = clsName;
}

/*
* @see java.util.logging.Logger#log(java.util.logging.LogRecord)
*/
@Override
public void log(LogRecord logRecord) {
if (logRecord == null) {
return;
}
logRecord.setSourceClassName(getClassName());
super.log(logRecord);
}

/**
* @param logger
* @param cls
* @return
*/
public static CXFLogger getLogger(String loggerName, String bundleName, Class<?> cls) {
CXFLogger logger = (CXFLogger) CXFLogger.getLogger(loggerName, bundleName);
logger.setClassName(cls.getCanonicalName());
return logger;
}

/**
* @param loggerName
* @param cls
* @return
*/
public static CXFLogger getLogger(String loggerName, Class<?> cls) {
return getLogger(loggerName, null, cls);
}
}
Loading

0 comments on commit 68471f1

Please sign in to comment.