Link to home
Start Free TrialLog in
Avatar of hpeng
hpeng

asked on

Strange Log4j problem, it doesn't work after a server call

Client application code:
   
 public ISession login(String username, String password){
        try {
            ...
            SessionFactory instance = SessionFactory.getInstance("http://localhost:7001/test");
            logger.info("111");
            //"111" can be printed out
            session = instance.createSession(params); // remote server call
            logger.info("222");
            .....
            //but "222" can't be printed out
        } catch (Exception e) {
            e.printStackTrace();
        }
        return session;
    }

1. The program can run successfuly and no Exception throw out
2. Any logger.info() won't work after the call "instance.createSession(..)", seems the remote call block the log4j, but I even re-create a new logger after that line, it still doesn't work.
3. the logger is totally a client log, will it be affected by some server calls?
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Are you sure that method returns?
Avatar of hpeng
hpeng

ASKER

Yes, the "instance.createSession(params)" do returns, and all statement after that line execute well except for any "logger.info ()"
Avatar of hpeng

ASKER

){
        try {
            ...
            SessionFactory instance = SessionFactory.getInstance("http://localhost:7001/test");
            logger.info("111");
            //"111" can be printed out
            session = instance.createSession(params); // remote server call
            logger.info("222");
          //but "222" can't be printed out
            System.out.println("333");
           //"333" can also be printed out
            .....
           
        } catch (Exception e) {
            e.printStackTrace();
        }
        return session;
    }
ASKER CERTIFIED SOLUTION
Avatar of Mayank S
Mayank S
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of hpeng

ASKER

The createSession() is a server mothod which I can't know the detail. And the logger is a local variable to current class only.
Although the scenario that mayank mentions seems improbable, it might be true ;-) I can't think of anything else at the moment

http://www.clavius.org/holmes.html
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial