logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject Re: How can i built a java application using java debug class on
Date Mon, 28 Aug 2006 21:53:33 GMT

AOP (Aspect Oriented Programming) + Log4j would fit the bill here.  Like James
said, Log4j has no way to do this automagically.

Jake

Quoting James Stauffer <stauffer.james@gmail.com>:

> AFAIK there is no way for log4j to automatically log every method
> entry/exit without explicit logging statements.
>
> On 8/28/06, debasis <acharya_archana2000@yahoo.co.in> wrote:
> >
> > hi,
> > yes Log4j is a purely logging API. but using Log4j i want to track the
> > method
> > entry and exit. what is AFAICS?
> >
> > can someone help me how to implement logging for  method entry parameters
> > and
> > method exit return value.
> >
> > can someone help me how to use log4j and integrate it to the method entry
> > logging and method exit logging.
> > Here what i need is without writing the log statements for the method entry
> > and
> > method exit i need to log it to the file
> > along with other log4j debug statements i provide in the file.I should be
> > able
> > to configure whether to enable/disable the logging
> > for method entry and method exit. In method entry i should be able to log
> > the
> > parameters the method take and in method exit
> > i should be able to log te return value to the log file, before the method
> > is
> > returned to the callee.
> >
> > i hope i am clear
> >
> > Thanks in advance.
> >
> >
> > thanks & regards,
> >
> > Blok, Eelke wrote:
> > >
> > > Hi,
> > >
> > > I'm assuming by o/p you mean output.
> > >
> > > I think that you're confusing a logging API with a debugging API. I'm
> > > not familiar with the Java debugging API that you mention, but I'm
> > > guessing it's not the same as the Java logging API, and I would expect
> > > that it taps into the JVM somehow (that, AFAICS, is the only way to get
> > > the kind of output about methods being entered and exited that you're
> > > showing, without modifying the actual code).
> > >
> > > Log4J doesn't do this, it is purely a logging API, i.e. what you want to
> > > come out, you have to put into it first.
> > >
> > > Best regards,
> > >
> > > Eelke Blok
> > >
> > > -----Original Message-----
> > > From: debasis [mailto:acharya_archana2000@yahoo.co.in]
> > > Sent: vrijdag 25 augustus 2006 14:53
> > > To: log4j-user@logging.apache.org
> > > Subject: Re: How can i built a java application using java debug class
> > > on
> > >
> > >
> > >
> > > yes i need to track the method entry and exit abt need the o/p as
> > > -- VM Started --
> > >> ====== main ======
> > >> main -- HelloExample
> > >> callerMethod -- HelloExample
> > >> ====== main end ======
> > >> -- The application exited --
> > >>
> > >
> > > this typr of o/p is possible using java Debug API. but i need to built
> > > this sort of appplication using Log4j. i do not need o/p on the console
> > > and the programme should be independent of Application server. is it
> > > possible and if so how?
> > >
> > > Thanks & Regards,
> > >
> > >
> > >
> > > James Stauffer wrote:
> > >>
> > >> I don't quite understand what you want to do.  One note is that you
> > >> mignt want to use the log4j NDC class to track method entry and exit.
> > >>
> > >> On 8/25/06, debasis <acharya_archana2000@yahoo.co.in> wrote:
> > >>>
> > >>> Hi,
> > >>> As java API support the MethodEntryEvent, using which I can get the
> > >>> automatic logging statements when the method is entered or exited as
> > >>> HelloExample.main(with argument type). Where HelloExample is the
> > >>> class name. Main is the method entered with its argument types.
> > >>> In some cases I have the o/p as
> > >>> -- VM Started --
> > >>> ====== main ======
> > >>> main -- HelloExample
> > >>> callerMethod -- HelloExample
> > >>> ====== main end ======
> > >>> -- The application exited --
> > >>>
> > >>> By using Log4J is there any possibility of getting these sort of o/p
> > >>> along with the loggers supported by Log4J. i mean to say can i built
> > >>> an java application which supports the MethodEntryEvent and
> > >>> MethodExitEvent from java API and also uses the Log4J debugging. I
> > >>> took an e.g. trace example, which (in J2SE 1.4.x or 5.x) will be
> > >>> found in $JAVA_HOME/demo/jpda/examples.jar and unpacking it by
> > >>> jar -xvf $JAVA_HOME/demo/jpda/examples.jar i found the
> > >>> com/sun/tools/example/trace/Trace.java and passed the class
> > > constructed
> > >>> with
> > >>> logger taken from Log4J. In this case the logging message is
> > > displayed on
> > >>> the console. As per the requirement i need to transfer the whole o/p
> > > to
> > >>> an
> > >>> output file along with Log4J logger statements. in this case i should
> > > not
> > >>> give any command in the cosule except compiling and executing the
> > >>> programme.
> > >>> the programm also should able to run without the main() as i need to
> > >>> integrate Log4J with an application and the code must me application
> > >>> server
> > >>> independent. i need the output as i got using MethodEnteryEvent
> > > (shown as
> > >>> above) in case of java application built using Log4J.
> > >>>
> > >>> Can any one help me in this regard. can any one give me some
> > >>> suggestion or any programme of this sort. All suggestions are
> > >>> welcomed.
> > >>>
> > >>> Thanks & Regards,
> > >>> --
> > >>> View this message in context:
> > >>> http://www.nabble.com/How-can-i-built-a-java-application-using-java-d
> > >>> ebug-class-on-tf2162917.html#a5977690
> > >>> Sent from the Log4j - Users forum at Nabble.com.
> > >>>
> > >>>
> > >>> ---------------------------------------------------------------------
> > >>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > >>> For additional commands, e-mail: log4j-user-help@logging.apache.org
> > >>>
> > >>>
> > >>
> > >>
> > >> --
> > >> James Stauffer        http://www.geocities.com/stauffer_james/
> > >> Are you good? Take the test at http://www.livingwaters.com/good/
> > >>
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > >> For additional commands, e-mail: log4j-user-help@logging.apache.org
> > >>
> > >>
> > >>
> > >
> > > --
> > > View this message in context:
> > > http://www.nabble.com/How-can-i-built-a-java-application-using-java-debu
> > > g-class-on-tf2162917.html#a5982923
> > > Sent from the Log4j - Users forum at Nabble.com.
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > > For additional commands, e-mail: log4j-user-help@logging.apache.org
> > >
> > >
> > >
> > > PRIVACY: The information transmitted is intended only for the person or
> > > entity to which it is addressed and may contain confidential and/or
> > > priviliged material. Any review, retransmission, dissemination or other
> > > use of this information by persons or entities other than the intended
> > > recipient is prohibited. If you received this in error, please contact
> > > the sender and delete the material from any computer. Thank you.
> > >
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > > For additional commands, e-mail: log4j-user-help@logging.apache.org
> > >
> > >
> > >
> >
> > --
> > View this message in context:
>
http://www.nabble.com/How-can-i-built-a-java-application-using-java-debug-class-on-tf2162917.html#a6019352
> > Sent from the Log4j - Users forum at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> >
> >
>
>
> --
> James Stauffer        http://www.geocities.com/stauffer_james/
> Are you good? Take the test at http://www.livingwaters.com/good/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>




---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message