?
Solved

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

Posted on 2006-05-20
9
Medium Priority
?
301 Views
Last Modified: 2010-03-31
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?
0
Comment
Question by:hpeng
  • 3
  • 3
7 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 16728088
Are you sure that method returns?
0
 

Author Comment

by:hpeng
ID: 16730856
Yes, the "instance.createSession(params)" do returns, and all statement after that line execute well except for any "logger.info ()"
0
 

Author Comment

by:hpeng
ID: 16731179
){
        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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 30

Accepted Solution

by:
Mayank S earned 252 total points
ID: 16734254
Sounds like you are changing some log settings in createSession. Is 'logger' globally accessible for modification?
0
 

Author Comment

by:hpeng
ID: 16739244
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
 
LVL 86

Expert Comment

by:CEHJ
ID: 16740285
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
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 248 total points
ID: 16740295
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

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Suggested Courses
Course of the Month14 days, 7 hours left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question