Q:

Is it possible to handle all instances of a running Loggers during particular time period

Is it possible to handle all running Logger classes and copy their output to some another hub during some timeperiod?
For example:
package com.ubs.testing;

import org.apache.log4j.Logger;

public class ClassA {

    private static final Logger LOG = Logger.getLogger(ClassA.class);

    public void classAMethod() {
        LOG.info("Class A starts logging");
    }

}

package com.ubs.testing;

import org.apache.log4j.Logger;

public class ClassB {
    private static final Logger LOG = Logger.getLogger(ClassB.class);

    public void classBMethod() {
        LOG.info("Class B starts logging");
    }
}

package com.ubs.testing;

import org.apache.log4j.Logger;
import org.testng.annotations.Test;

public class ClassABTest {
    private static final Logger LOG = Logger.getLogger(ClassABTest.class);

    @Test
    public void testClassAB() throws Exception {
        LOG.info("Test class AB starts");

        /*Some logic*/

        /* >>>HERE I WANT TO START HANDLING OF THE LOGGING OUTPUT AND STORE IT IN SOME OTHER OBJECT<<<*/

        ClassA a = new ClassA();
        ClassB b = new ClassB();
        a.classAMethod(); // I want to get "Class A starts logging" message from ClassA Logger here
        b.classBMethod(); // I want to get "Class B starts logging" message from ClassA Logger here

        /* >>>HERE I WANT TO FINISH HANDLING OF THE LOGGING OUTPUT IN SOME OTHER OBJECT<<<*/

        LOG.info("Test class AB ends");

    }

}

Sorry if similar questions were posted before.
Thanks in advance for suggestions.

A:

Forgot to left respone erlier.
Just switching from log4j to logback gave me a possibility to left markers, which can be handled by custom appender. 
Another solution can be realized using Spring aop. Unfortunatelly mentioned issue cannot be resolved in this way, due to absence of the Spring framework within a project.

