Results 1 to 3 of 3
  1. #1
    urbanleg is offline Member
    Join Date
    Jul 2011
    Posts
    25
    Rep Power
    0

    Default design pattern question

    Hi all.

    I have a working java application,
    this application got tons of methods / functions that do some stuff.

    i would like to create a new class that will log all these method calls, for example:

    i want a method like this: doSomething (object target1) {..}

    to be logged (every time it is called) in my new log-class like this : date/class-name:doSomething/parameters:target1

    a simple solution (inefficient) will be to put a call in any of my methods\functions like this:

    doSomething (object target1) {
    Mylog.(date,"doSomething",target1);
    ....}

    i really dont want to add manually in every place this kind of call.. is there any more efficient way to do it??


    p.s - the log is only an example, my class is not really a log. but its easier to understand this way.


    Thanks!

  2. #2
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,058
    Rep Power
    5

    Default Re: design pattern question

    Sounds like a job for JPDA.
    Get in the habit of using standard Java naming conventions!

  3. #3
    2by4 is offline Banned
    Join Date
    Dec 2011
    Posts
    143
    Rep Power
    0

    Default Re: design pattern question

    Will this functionality, whatever it is, be switched on in the live production environment?

    You may have to consider search and replace using regular expressions to insert the boilerplate code. I had a similar requirement and wrote a utility to handle such replacements.

Similar Threads

  1. State Design Pattern
    By blackbird in forum New To Java
    Replies: 3
    Last Post: 07-19-2011, 05:05 AM
  2. A little design (pattern?) question...
    By raindog308 in forum New To Java
    Replies: 1
    Last Post: 01-26-2011, 09:12 AM
  3. question on j2ee design pattern
    By Minu in forum Advanced Java
    Replies: 1
    Last Post: 01-06-2009, 07:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •