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?
hpengAsked:
Who is Participating?
 
Mayank SConnect With a Mentor Associate Director - Product EngineeringCommented:
Sounds like you are changing some log settings in createSession. Is 'logger' globally accessible for modification?
0
 
CEHJCommented:
Are you sure that method returns?
0
 
hpengAuthor Commented:
Yes, the "instance.createSession(params)" do returns, and all statement after that line execute well except for any "logger.info ()"
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
hpengAuthor Commented:
){
        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;
    }
0
 
hpengAuthor Commented:
The createSession() is a server mothod which I can't know the detail. And the logger is a local variable to current class only.
0
 
CEHJCommented:
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
0
 
CEHJConnect With a Mentor Commented:
Oh hang on sorry - there *is* something else, and that's log4j does have occasional trouble flushing its streams/buffers. But if  you can consistently produce the same error at the same place, that's not very compelling as a reason either.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.