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,

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.

Similar Messages

  • Deploying no java applications using Java Web Start

    Hi,
    I am new to java web start. Is it possible to distribute non java applications using java web start. I have an APP which can run on a desktop in standalone mode. The app has jusy HTML and Java script files. Is it possible to package this app and deploying using java web start? I am assuming If it is possible, I can make updates to the packaged app in the web servers and the updates will be downloaded next time the app is used provided configurations are correct?
    thx

    The app has jusy HTML and Java script files. Is it possible
    to package this app and deploying using java web start? Not really. Resources for JWS need to be zipped,
    while this HTML/JS app. will (I guess) not work from
    inside the depths of a Jar (or Zip) archive.
    Note that you can organise for those files to be
    downloaded and expanded onto a known place
    on the user's disk, by using an 'installer' element,
    but..
    ...I am assuming If it is possible, I can make updates to the
    packaged app in the web servers and the updates ..installers are only called once, and do not 'update'.

  • How can an email account be created using Java mail on the FLY.

    Scenario is such that i am using mail server from MDaemon.com and JavaMail api,and making Email website like yahoo...some what ! but how can a user create his account by just filling the form and when he enters his account be created in Mail server..

    Last time I checked MDaemon has its own API for account management. I have never tried to do anything with it but their sales literature says it exists.
    Account management will be specific to the platform and mail server software. This is beyond the scope of JavaMail which is for message transport (and management to an extent on IMAP servers), not account management on the server.
    The other alternative is to write your own application that modifies the structures used by mdaemon but since it already has an API why bother.

  • How can i design a EJB application using session Beans?

    Hello,
    I am designing a Find application using EJB. Here a user is prompted a search page, where he can enter the search criteria's. Then on click of submit, the query is formed at the server side depending on what criteria's were selected. Then a jdbc query is performed and the results are returned back to the user. Here no session is maintained for the users. Can anyone suggest me how to design this application using EJB. Should i use entity beans for this or session beans will suffice? Should the jdbc query be performed in the bean itself or should it be outside in a helper class? Please kindlu suggest me the design for this application...
    Regards,
    Subbu

    Hi,
    First of all, I'm unable to figure out why you need to use EJB for this scenario. You can write a helper class to frame and execute the query.
    If you really want to use EJB, then I suggest you use a stateless Session Bean with transaction attribute as TX_NOT_SUPPORTED. From the session bean, you can call the helper class. But, by avoiding the session bean, you can eliminate remote calls, thus improving your performance. Also, check if the database & the db driver you are using supports sql caching.
    Regards,
    Raj.

  • How can I develop a web application using EJB design pattern?

    I have searched over the web and found quite a lot of tutorials on how to use the EJB design pattern.
    I know that there will be a home interface, EJB object interface and a SessionBean.
    But the tutorials often only cover a single class, this made me unable to get a complete picture of how EJB design pattern can be implemented into a whole system.
    I am now required to devleop an online shopping web application using EJB and JSP page.
    I think I will need to create a lot of classes: Member, ShoppingCart, Product...etc.
    What I want to ask is that, do I need to create a home interface, EJB object interface and a SessionBean for each of these classes?
    I really need some ideas on how to develop this system using EJB + JSP pages.
    Many thanks to you all.

    For every EJB that you want to create, you will need to code a home and remote interface and a bean class.
    You could start getting your ideas here
    http://www.theserverside.com/books/wiley/masteringEJB/
    http://www.coreservlets.com

  • How can I connect to a database using Java Web Start?

    When I run the application without Java Web Start, the program can get the driver and connect to the database. However, when I try to use this same application with Java Web Start, the program can not load the driver. Why is this happening? I am using a mySql database driver.

    I assume you are trying to connect using JDBC, are did you include the jdbc jar in your resources ?

  • How can i digital sign a file using JAVA?

    and how can i verify the digitially signed file was not altered by anyone using JAVA?
    please provide me with the simpliest way to do this.
    thanks a lot.

    I have no idea but you might want to take a look at :
    http://java.sun.com/j2se/1.5.0/docs/guide/security/index.html
    hth

  • How can I open/save .xlsx file using java

    Hi
    I have a jsp whose contenttype of response is application/vnd.ms-excel.
    When I am saving the file as .xlsx and opening from disk it displays error message.
    How can I save and/or open the file as .xlsx?
    Any advice will be appreciated.
    Thanks
    Rohini Kumar J

    sunshine_vennela wrote:
    I have a jsp whose contenttype of response is application/vnd.ms-excel.That's not the way to create excel files. You're just creating a plain vanilla HTML file and fooling the browser with a wrong content type.
    Checkout the Apache POI XSSF API or the OpenXML4J API's to create xlsx files and use a servlet to write it to the outputstream.

  • How can I get selected EXCEL area using java script office API (v 1.0)

    Hello everyone,
    I need to get values of specified area in an excel sheet using java Script Office API. For an example,
    A1:A7 row load into array using JS. 

    And you posted to a C++ forum, not a JavaScript or Excel forum.... why? 
    Visual C++ MVP

  • Disk Space "leaking" in Java Application Using java.io.RandomAccessFile

    I have noted this behaviour in both java version 1.2.1 and 1.3.1 on Solaris 5.8.
    I have a java application that is essentially "tailing" a very large log file.
    The program opens a RandomAccessFile in read-only mode and calls readLine on the file as long as the file is getting written to.
    If the file stops getting updated the program assumes the logfile has been moved/rotated/wrapped (by an external process) and the program the calls close and then reopens the file to allow the program to start reading from the new file and to allow the O/S to free up the system resources.
    It appears that the program is not actually closing the filehandle or releasing the disk space and eventually the disk fills up.
    When this happens the program is stopped and restarted and the disk space is freed up.
    We have run the pfiles command against the running process and have confirmed that the old filehandles are still open.
    I have attached what I think to be the relevant code lines below:
    RandomAccessFile filehandle = null;
    boolean reopen = true;
    boolean connected = true;
    while(connected)
    if (reopen)
    while(! new File(filename).exists())
         doSleep (filewaittime);
              filehandle = new RandomAccessFile(filename, "r");
    while (file_being_updated)
    // read from the file etc.
    filehandle.close();
    filehandle = null;
    reopen = true;
    The reopen flag is set to false in code not shown here.
    I have verified that the block of code that calls close() on the filehandle and sets it to null is being executed when the logfile is moved externally.

    Hmmmm. Sounds like a hint to me :)
    I am still experimenting but I will certainly try moving to the latest JDK and report a bug if I don't figure this out on my own.
    Thanks.

  • How can i send the chinese sms using java J2EE(web application)

    hi,
    i have the difficulty on sending chinese sms using J2EE application.i try to input the chinese word to jsp and send the plain text sms. i received the sms with plenty of question mark "?????". i think it is regarding to the conversion of String to some kind of format that supported by mobile phone. below are some code the send the sms to recipient. i need someone help in order to have the solution.
    thanks a lot
    <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
    <%@ page import="se.sapio.rta.service.MPMService"%>
    <%@ page import="java.util.Locale"%>
    <%
         Locale.setDefault(Locale.UK);
         Context ctx;
         MPMService mpmservice;
         ctx = new InitialContext();
         mpmservice = (MPMService) ctx.lookup("BC/Service/RTAMPM");
         LSUser user = null;
         boolean ok = true;
         try {
         if (ok) {
              String sender = request.getParameter("sender");
              String phonenr = request.getParameter("phonenr");
              String sendmsg = request.getParameter("sendmsg");
              if(bError) {
                   byte[] bytes = message.getBytes("UTF-8");
                   message = mobileclientservice.ByteEncode(bytes);          
                   response.sendRedirect("send_sms.jsp?s="+request.getParameter("s")+"&msg="+message+"&phonenr="+request.getParameter("phonenr").replaceAll("\\+","%2B")+"&sender="+request.getParameter("sender")+"&sendmsg="+request.getParameter("sendmsg").replaceAll("\\+","%2B"));
              String resp = "";
              if(mpmservice.sendPlainTextSMS(sender, phonenr, sendmsg)) {
                   resp=mpmservice.getLang(user.getLang(), "sms_sent");
              } else {
                   resp=mpmservice.getLang(user.getLang(), "sms_not_sent");
              } %>
              <jsp:include page="/top.jsp" />
              <p class="headline"><%=mpmservice.getLang(user.getLang(), "send_sms_title")%></p>
              <form name="operatordetails" id="operatordetails" method="post" action="send_sms.jsp">
              <INPUT TYPE=hidden NAME=s VALUE="<%=request.getParameter("s")%>">
              <INPUT TYPE=hidden NAME=phonenr VALUE="<%=request.getParameter("phonenr")%>">
              <table class="infotable" id="report">
                   <tr>
                        <td class="left" colspan="2"><%=resp%></td>
                        <td class="right"></td>
                   </tr>
                   <tr>
                        <td class="left" colspan="2">
                             <input class="halfmiddle" name="Back" type="submit" id="Back" value="<%=mpmservice.getLang(user.getLang(), "back")%>" />
                        </td>     
                        <td class="right"> </td>
                   </tr>
              </table>
              </form>
              <jsp:include page="/bottom.jsp" />
         <% } %>
       public boolean sendPlainTextSMS(String sender, String recipient, String sendmsg){
             if(recipient.charAt(0) == '+')
                   recipient = recipient.substring(1);
             String senderIdType = "Alpha";
              if( (sender.charAt(0) >= '0' && sender.charAt(0) <= '9') || sender.charAt(0) == '+')
                   senderIdType = "Numeric";
                   if(sender.charAt(0) == '+')
                        sender = sender.substring(1);
                   for(int i=0; i < sender.length(); i++)
                        if(!(sender.charAt(i) >= '0' && sender.charAt(i) <= '9'))
                             senderIdType = "Alpha";
             log.warn("sending sms to: "+recipient + " sendtype: " + senderIdType + " msg: "+ sendmsg);
             log.warn("Encoded sms:"+Encode(sendmsg));
             try{
             String postData = "XMLDATA=" + URLEncoder.encode("<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\r\n" +
                        "<NotificationRequest Version=\"3.4\">\r\n" +
                        "     <NotificationHeader>\r\n" +
                        "          <PartnerName>" + SMS_PARTNER_NAME + "</PartnerName>\r\n" +
                        "          <PartnerPassword>" + SMS_PARTNER_PASSWORD + "</PartnerPassword>\r\n" +
                        "          <SubscriptionName>XML</SubscriptionName>\r\n" +
                        "     </NotificationHeader>\r\n" +
                        "     <NotificationList BatchID=\"1\">\r\n" +
                        "          <Notification SequenceNumber=\"0\" MessageType=\"SMS\">\r\n" +
                        "          <Message>" + Encode(sendmsg) + "</Message>\r\n" +
                        "          <Profile>" + SMS_PARTNER_PROFILE + "</Profile>\r\n" +
                        "          <SenderID Type=\"" + senderIdType + "\">" + sender + "</SenderID>\r\n" +
                        "          <Subscriber>\r\n" +
                        "               <SubscriberNumber>" + recipient + "</SubscriberNumber>\r\n" +
                        "          </Subscriber>\r\n" +
                        "      </Notification>\r\n" +
                        " </NotificationList>\r\n" +
                        "</NotificationRequest>","ISO-8859-1");
      appreciate for anyone provide the solution.
    thanks a lot

    Hi,
    I want to send sms from web application to mobile phones at the time of registration. Its verymuch greatful to me, if you let me know, how to send from jsp to mobile. because from your post, i got, you already know about sending sms from jsp to mobile.
    please let me know, how to send sms
    [email protected]
    Thanks in advance for your kind help

  • How can i login to a website using java

    hi,
    i tried to write a java program to which will take username and password and login to a given site. but some how its not working. i am actually trying to login to the follwoing website:
    https://roundup.ffmpeg.org/roundup/ffmpeg/
    can anyone provide some example program to login to this website.
    br
    mahbubul-syeed

    Hi,
    i am really sorry... but i am new in this forum and i did not know this. here is my code that i have written. it did not show any error and displays the content of the page but did not logged in. please give your comment.. i badly need a solution.
    package myUtility_files;
    import java.net.*;
    import java.io.*;
    public class LogInByHttpPost {
         //private static final String POST_CONTENT_TYPE = "application/x-www-form-urlencoded";
    private static final String LOGIN_ACTION_NAME = "submit";
    private static final String LOGIN_USER_NAME_PARAMETER_NAME = "__login_name";
    private static final String LOGIN_PASSWORD_PARAMETER_NAME = "__login_password";
    private static final String LOGIN_USER_NAME = "mahbubul";
    private static final String LOGIN_PASSWORD = "mahbubul007";
    private static final String TARGET_URL = "http://roundup.ffmpeg.org/roundup/ffmpeg/";
    public static void main (String args[])
    LogInByHttpPost httpUrlBasicAuthentication = new LogInByHttpPost();
    httpUrlBasicAuthentication.httpPostLogin();
    public void httpPostLogin ()
    try
    // Prepare the content to be written
    // throws UnsupportedEncodingException
    String urlEncodedContent = preparePostContent(LOGIN_USER_NAME, LOGIN_PASSWORD);
    HttpURLConnection urlConnection = doHttpPost(TARGET_URL, urlEncodedContent);
    //String response = readResponse(urlConnection);
    System.out.println("Successfully made the HTPP POST.");
    //System.out.println("Recevied response is: '/n" + response + "'");
    BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
                   String inputLine;
                   while ((inputLine = in.readLine()) != null)
                        System.out.println(inputLine);
    catch(IOException ioException)
         ioException.printStackTrace();
    System.out.println("Problems encounterd.");
    private String preparePostContent(String loginUserName, String loginPassword) throws UnsupportedEncodingException
    // Encode the user name and password to UTF-8 encoding standard
    // throws UnsupportedEncodingException
    String encodedLoginUserName = URLEncoder.encode(loginUserName, "UTF-8");
    String encodedLoginPassword = URLEncoder.encode(loginPassword, "UTF-8");
    String content = "login=" + LOGIN_ACTION_NAME +" &" + LOGIN_USER_NAME_PARAMETER_NAME +"="
    + encodedLoginUserName + "&" + LOGIN_PASSWORD_PARAMETER_NAME + "=" + encodedLoginPassword;
    return content;
    public HttpURLConnection doHttpPost(String targetUrl, String content) throws IOException
    HttpURLConnection urlConnection = null;
    DataOutputStream dataOutputStream = null;
    try
    // Open a connection to the target URL
    // throws IOException
    urlConnection = (HttpURLConnection)(new URL(targetUrl).openConnection());
    // Specifying that we intend to use this connection for input
    urlConnection.setDoInput(true);
    // Specifying that we intend to use this connection for output
    urlConnection.setDoOutput(true);
    // Specifying the content type of our post
    //urlConnection.setRequestProperty("Content-Type", POST_CONTENT_TYPE);
    // Specifying the method of HTTP request which is POST
    // throws ProtocolException
    urlConnection.setRequestMethod("POST");
    // Prepare an output stream for writing data to the HTTP connection
    // throws IOException
    dataOutputStream = new DataOutputStream(urlConnection.getOutputStream());
    // throws IOException
    dataOutputStream.writeBytes(content);
    dataOutputStream.flush();
    dataOutputStream.close();
    return urlConnection;
    catch(IOException ioException)
    System.out.println("I/O problems while trying to do a HTTP post.");
    ioException.printStackTrace();
    // Good practice: clean up the connections and streams
    // to free up any resources if possible
    if (dataOutputStream != null)
    try
    dataOutputStream.close();
    catch(Throwable ignore)
    // Cannot do anything about problems while
    // trying to clean up. Just ignore
    if (urlConnection != null)
    urlConnection.disconnect();
    // throw the exception so that the caller is aware that
    // there was some problems
    throw ioException;
    br
    mahbubul-syeed
    Edited by: mahbubul-syeed on Jun 11, 2009 5:07 AM

  • How can i rename a jar file using only java code

    i have tried everything i can think of to accomplish this but nothing works.

    ghostbust555 wrote:
    In case you geniuses haven't realized I said I tried everything I can think of not that I tried everything. So help or shut up I realize that I didn't try everything but if you can't figure it out either DO NOT POST.
    And the question is how can i rename a jar file using java code? As it says in the title. Read.I would tell you to use the File.renameTo method, but surely that would have been obvious, and you would have tried it already? But maybe you didn't. You were kind of lacking in details in what you tried.
    And yes, I am a genius. Just don't confuse "genius" with "mind-reader".

  • Executing Jar Application using Java Programs

    Hello there,
    How can I run a java application using java programs.
    Desc:
    public class someapp {
       public static void main(String[] ext) {
           // How can I execute a jar application from here through java code
    }

    You could use java.lang.Runtime.exec(). Another way could be loading the main class of the jar file and invoking its main method dynamically.

  • How can i call a VB6 project from my java application using JNI

    hi
    can anyone tell me the procedure of calling a VB6 project from any java application using JNI
    if anyone does know then tell me the detail procedure of doing that. I know that i have to create a dll of that VB6 project then to call it from the java application.
    if anyone know that procedure of creating dll file of an existing VB6 project please reply
    please if anyone know then let me know

    Ahh, kind of a duplicate thread:
    http://forums.java.sun.com/thread.jspa?threadID=631642
    @OP. You could have clarified your original post and the relationship of your question to java. You did not need a new thread.
    � {�                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Maybe you are looking for

  • My iPad mini is dead and won't charge!!!!

    My iPad mini was nearly dead, so I plugged it in. However, it didn't say it was charging. And now it's completely dead. I've tried using a different charger and switching wall sockets, but nothing will work. It won't turn on it just has the symbol te

  • Unable to install itunes on XP. Get Error 7

    Unable to install itunes on XP. Get Error 7

  • Editing Word docs

    What is the preferred app for editing Microsoft Word docs ie .docx, please? Many thanks

  • OS X Yosemite and Aperture 3

    I recently installed OS X Yosemite on my mac book pro and since I can not open my Aperture software - it says "You can't use this version of the application "Aperture" with this version of OS X. You have "Aperture" 3.2.4." there is an upgrade availab

  • URL Configuration setting in SRM

    Hi, We are implementing SRM 5.0. Where we suppose to define the URL( SRM portal page) in configuration? Is there is any documentation available for setting up the URL connections? Helpfull answers will be rewarded. Thanks & Best Regards