How can i built a java application using java debug class on Log4J

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,

[1785 byte] By [archana_acharyaa] at [2007-10-3 3:28:03]
# 1

hi,

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.

archana_acharyaa at 2007-7-14 21:21:34 > top of Java-index,Archived Forums,Debugging Tools and Techniques...