-
Aug 20th, 2006, 12:14 AM
#1
logging intercept help needed
Hi,
I am new to spring..implementing logging aspect...i have couple of questions
1) my java objects do not have interfaces.do i need to create interfaces to all of my java objects to use logging aspect with spring.if yes then is there any easy solution...
2) generally we have log statements to print a value or who logged or return values from a particular method call inside a method like below..Can these also be proxied through interceptors ?
public myMethod (list a, string b) {
log.debug ("user : " + session.getUser ());
log.debug ("value of b" + b);
list c = getEmplyoeesFromDB ();
log.debug ("Employees from db : "+ c);
}
in the above method i have 3 log statements...can i take those out and have in my interceptor so that my developer can enable particular logging for a particular method if needed through patterns in xml ..if yes can u provide a sample code or config to do same..if not then can we only trace before, after calling a method and during exceptions..and still we need to write custom logging inside mehods ?
appreciate ur help..
thanks in advance
-
Aug 20th, 2006, 05:02 AM
#2
Yes, you can use a tracing intercept for this, and it will be invoked at particular points (before, after, around, for exception, etc). But, I think you will still need to use logging, if logging will be needed at other locations in a method, with easy AOP anyway.
To me, tracing and logging are different. Logging requires developer insight into what is happening and what is important, thus, the message string is important. Whereas, tracing is mechanical. Also, the performance requirements are different. Logging is in the code longer term, so it should have minimal impact and allow external configuration (log levels for example).
-
Aug 20th, 2006, 08:07 AM
#3
help needed
Thanks for the reply...i think i still did not understand or got reply for question 1)...
1) my java objects do not have interfaces.do i need to create interfaces to all of my java objects to use logging aspect with spring.if yes then is there any easy solution...
2) Can u point me or give a sample how to implement logging and tracing interceptors...
thanks in advance.
-
Aug 20th, 2006, 09:55 PM
#4
Some good posts are going on right now on this topic here: http://forum.springframework.org/showthread.php?t=28255
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules