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(par ams); // 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?
public ISession login(String username, String password){
try {
...
SessionFactory instance = SessionFactory.getInstance
logger.info("111");
//"111" can be printed out
session = instance.createSession(par
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(..
3. the logger is totally a client log, will it be affected by some server calls?
Are you sure that method returns?
ASKER
Yes, the "instance.createSession(pa rams)" do returns, and all statement after that line execute well except for any "logger.info ()"
ASKER
){
try {
...
SessionFactory instance = SessionFactory.getInstance ("http://localhost:7001/test");
logger.info("111");
//"111" can be printed out
session = instance.createSession(par ams); // 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;
}
try {
...
SessionFactory instance = SessionFactory.getInstance
logger.info("111");
//"111" can be printed out
session = instance.createSession(par
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
http://www.clavius.org/holmes.html
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.