Chaotic Logging problem
ziphyre Feb 20, 2008 7:37 PMHi,
I have a log.info(...) instruction (the third one) who doesn't get executed at all (at least I thing so)
@Logger private Log log; @In private Identity identity; @PersistenceContext private EntityManager entityManager; public boolean authenticate() { User u; log.info("1- username: #0", identity.getUsername()); Query q = entityManager.createQuery("from User u where u.phoneNumber = 'xxxxxx' and u.password = 'xxxxxx'"); log.info("2- password: #0", identity.getPassword()); try { u = (User) q.getSingleResult(); log.info("3- password: #0", u.getPassword()); } catch (NoResultException e) { return false; } return true; }
And the result is:
20:21:36,930 INFO [Authenticator] 1- username: 123 20:21:36,939 INFO [Authenticator] 2- password: 123 20:21:36,941 INFO [STDOUT] Hibernate: select user0_.id as id4_, user0_.password as password4_, user0_.fullName as fullName4_, user0_.phoneNumber as phoneNum4_4_ from User user0_ where user0_.phoneNumber='xxxxxx' and user0_.password='xxxxxx' 20:21:37,116 INFO [Authenticator] 1- username: 123 20:21:37,116 INFO [Authenticator] 2- password: 123 20:21:37,123 INFO [STDOUT] Hibernate: select user0_.id as id4_, user0_.password as password4_, user0_.fullName as fullName4_, user0_.phoneNumber as phoneNum4_4_ from User user0_ where user0_.phoneNumber='xxxxxx' and user0_.password='xxxxxx'
Well, I have 3 question:
1-) Why the third log instruction
log.info("3- password: #0", u.getPassword());
doesn't get logged?
2-) When the previous code is executed for the first time, as you see it logs 2 times the same thing? But the following executions log only once (password xxxxx is wrong so I always try to log in...)
By the way, it's the authenticator method of the basic seam-gen generated code, without major modifications
Thanks for any clarification.