R.Zeus
Dec 3rd, 2006, 08:23 PM
in my project ,I need to log every transaction in the service.the log need
the login user name which filtered by the Acgi Security.the problem is how can I get the user name in the service?
the first way is geting the user name from session in the struts action class and then passing to the service class.but it make the service mothod ugly.
the second way is using spring advice and advicer to log outside the service .but this way can't record the detailinfomation.
the thired way is using " SecurityContextHolder.getContex().getAuthenticatio n()" to get the user name .but it seems not obey the AOP principle.
how do u log every thing that needed the login user name?
the login user name which filtered by the Acgi Security.the problem is how can I get the user name in the service?
the first way is geting the user name from session in the struts action class and then passing to the service class.but it make the service mothod ugly.
the second way is using spring advice and advicer to log outside the service .but this way can't record the detailinfomation.
the thired way is using " SecurityContextHolder.getContex().getAuthenticatio n()" to get the user name .but it seems not obey the AOP principle.
how do u log every thing that needed the login user name?