• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can I put SOP from where method is called ?  RSS feed

 
tanu dua
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am debugging some code in which there is one method which is invoked from some 25 places around , so I want to know from where that is invoked.One way is to put System.out.println() in all the 25 places but that seems to be quite cumbersome approach.

Can I have something in reflection which I can put in the invoked method from where it is called ?
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not think one would face such issues if the logging of the application is proper.Use log statements for these purposes and check the log file.In production you can turn off the logger or put that on FATAL mode.
 
Raghavan Muthu
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The best way is to use the debugging facility comes along with the IDE. But if you are debugging it in offline, the suggestable and efficient way is to go with logging.

As rahul said, check your log file properly. Using SOP's is not a better way to deal with.
 
tanu dua
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks !!

I am trying to use logging facility but logs are not enough.So , is there any way we can know from where method is called , that would be very helpful to me
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at the Thread.getStackTrace method.
 
tanu dua
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.

I have used Thread.currentThread().dumpStack() to get the trace from where the method is being called.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!