• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Loggers to identify the name of the method execution

 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
]I have a scenario with 1000 of classes and I am not able to debug the scenarios to identify the code flows.


I want to add loggers in each and every method starting point of all the classes.


It takes more time to write loggers code manually in all the classes.


What is the alternative approach which writes loggers when it enters into each method in any of the classes?.
 
Sheriff
Posts: 67645
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Because you are talking about classes, and since few people are using ES6 on the web so far, I suspect your question may be more about Java and not about JavaScript.

Which is it?
 
Marshal
Posts: 75869
361
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can't sue the debugging facilities of an IDE to do that?
 
Saloon Keeper
Posts: 25653
183
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:You can't sue the debugging facilities of an IDE to do that?



In the USA, you can sue anybody

Yeah,  I know. My fingers don't work in the right order, either.

Tracing each and every method will quickly bury you alive and it's almost never either necessary or a good idea. If you really wanted to log each method, though, the simplest way would probably to employ aspect-oriented programming.

Actually, it sounds like this particular system would benefit from the employment of a code coverage documentation tool.

Note that in some IDEs, if you want to see who's calling a method, it's often as easy as a right-mouse click in the method source code. In Eclipse, for example, the right-mouse menu "References" submenu will do this.
 
Campbell Ritchie
Marshal
Posts: 75869
361
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:. . . In the USA, you can sue anybody . . ..

Hahahahahahahahaha! It's getting nearly as bad here in UK, but the debugging function isn't a person in the eyes of the law
 
Tim Holloway
Saloon Keeper
Posts: 25653
183
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hariharan, I think I can resolve that if you stop "shouting". See your PM.
 
Ranch Hand
Posts: 52
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Aspect Oriented Programming framework will be handy in these situation, search for Spring AOP based logging feature.
 
Tim Holloway
Saloon Keeper
Posts: 25653
183
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Lakshman Arun wrote:Aspect Oriented Programming framework will be handy in these situation, search for Spring AOP based logging feature.



That was my original thought as well, but apparently the need is to track methods invoked by Drools, so I think that I can suggest something easier here.

When OP has adjusted his latest response to meet our message formatting standards (it's currently invisible to non-moderators).
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic