Hi,

With karaf 4.1.x, the pax-logging impl is changed to pax-logging-log4j2, but 
after that, we have wrong bundle.id, bundle.name in the logs in case of the log 
is come from the embeded jar of the bundle.


We have a CommonLoggingBean inside the common jar.

{code}

package beans;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


public class CommonLoggingBean {

    private static Logger logger = 
LoggerFactory.getLogger(CommonLoggingBean.class);

    public static void logMessage(String message) {
        logger.info(message);
    }

}
{code}


It is used by multiple bundles to print the logs, e.g bundle1, bundle2, when 
deploy the bundle1, bundle2 into the karaf 4.1.x container, the logs looks like:


|275 - test-log4j2-bundle1 - 1.0.0 | log from Bundle1

|275 - test-log4j2-bundle1 - 1.0.0 | log from Bundle2


Looks like the bundle.id/bundle.name always get from the bundle which is first 
deployed.


The expected logs should be:


|275 - test-log4j2-bundle1 - 1.0.0 | log from Bundle1

|276 - test-log4j2-bundle2 - 1.0.0 | log from Bundle2


Could this be something a bug from pax-logging-log4j2? Any clue would be 
appreciated. Thanks!


(Test projects are created)

https://github.com/xldai/test/tree/master/test-log4j2-bundle1

https://github.com/xldai/test/tree/master/test-log4j2-bundle2

https://github.com/xldai/test/tree/master/test-log4j2-common


Thanks.

Reply via email to