×

Discussion Board

Results 1 to 13 of 13
  1. #1
    Super Contributor
    Join Date
    Jan 2008
    Location
    Amravati, India
    Posts
    546

    Redirecting printStackTrace in Series 40 phones

    How to redirect printStackTrace in Series 40 phones to something like computer screen or file or any other?

    Thanks in advance

  2. #2
    Super Contributor
    Join Date
    Sep 2008
    Location
    Noida, U.P.
    Posts
    1,330

    Thumbs up Re: Redirecting printStackTrace in Series 40 phones

    Hi Arpit,
    Please can u explain that what do u want to do actually. Do u want to write output of printstacktrace filesystem or want to display at device screen? Is it so? Please reply if im wrong.
    thanks,
    jitu_goldie..

    KEEP TRYING..

  3. #3
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: Redirecting printStackTrace in Series 40 phones

    Hi,
    Are you talking about to make a log of the exceptions those were encountered...in a file or somewhere else,
    just write the exception in the file using the file connection...
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  4. #4
    Super Contributor
    Join Date
    Jan 2008
    Location
    Amravati, India
    Posts
    546

    Re: Redirecting printStackTrace in Series 40 phones

    I want to print stack trace of exception occurred in my application on Series 40 phones. Please tell me how to get the stack trace.
    Code:
    try{
        //some code here
    }
    catch(Exception ex){
        ex.printStackTrace();
        //how to get stack trace in a String so that I can write to file using file connection api.
    }

  5. #5
    Super Contributor
    Join Date
    Sep 2008
    Location
    Noida, U.P.
    Posts
    1,330

    Thumbs up Re: Redirecting printStackTrace in Series 40 phones

    Hi,

    No, you can't. Stack trace is always printed to System.err and there is no way in CLDC to redirect System.err to somewhere else.Even in CLDC 1.1 this does not exist.. hope Sun includes redirection of error and out stream in future versions.. It is very essential of logging/debugging..
    thanks,
    jitu_goldie..

    KEEP TRYING..

  6. #6
    Super Contributor
    Join Date
    Jan 2008
    Location
    Amravati, India
    Posts
    546

    Re: Redirecting printStackTrace in Series 40 phones

    Is there any way to do on device debugging in Series 40 phones?

  7. #7
    Super Contributor
    Join Date
    Sep 2008
    Location
    Noida, U.P.
    Posts
    1,330

    Thumbs up Re: Redirecting printStackTrace in Series 40 phones

    Hi,
    u can show alerts with the value u want to see at that time of any variable. show exception on alerts. I think this is one of the way can be taken for debugging on device.
    thanks,
    jitu_goldie..

    KEEP TRYING..

  8. #8
    Super Contributor
    Join Date
    Jan 2008
    Location
    Amravati, India
    Posts
    546

    Re: Redirecting printStackTrace in Series 40 phones

    Quote Originally Posted by jitu_goldie View Post
    Hi,
    u can show alerts with the value u want to see at that time of any variable. show exception on alerts. I think this is one of the way can be taken for debugging on device.
    That doesn't help if some file is throwing an exception which has 2000 lines of code.

  9. #9
    Super Contributor
    Join Date
    Sep 2008
    Location
    Noida, U.P.
    Posts
    1,330

    Thumbs up Re: Redirecting printStackTrace in Series 40 phones

    Hi,
    u can make ur code in blocks and keep a unique ID for each block like block 1,2,3.. and then print that block ID with that alert. Its quite a safe way to identify the error in each block. If u have some another idea to trace the error then please suggest it here.
    thanks,
    jitu_goldie..

    KEEP TRYING..

  10. #10
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: Redirecting printStackTrace in Series 40 phones

    Quote Originally Posted by arpit2agrawal View Post
    That doesn't help if some file is throwing an exception which has 2000 lines of code.
    Hi,
    I guess that being a developer your must be aware of the exception/errors that you code might throw...why do not you try to debug the code..by the in built debugger..and even you see that what was the error..which IDE you are using?
    There is something regarding for the S60 but I did not find anything for the s40.
    However you can follow this link-
    http://discussion.forum.nokia.com/fo...reply&p=564004
    Last edited by raj_J2ME; 2009-03-27 at 05:46. Reason: spell
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  11. #11
    Super Contributor
    Join Date
    Jan 2008
    Location
    Amravati, India
    Posts
    546

    Re: Redirecting printStackTrace in Series 40 phones

    Quote Originally Posted by jitu_goldie View Post
    Hi,
    u can make ur code in blocks and keep a unique ID for each block like block 1,2,3.. and then print that block ID with that alert. Its quite a safe way to identify the error in each block.
    Its very tedious when your project is in testing phase and it consists of around 100 class with 50000 lines of code. That can be done during development by following way:

    Write this class:
    Code:
    public class ClassDebugging{
        public static final boolean IsDebug = true; //Make this false for release build
        public static void LogMessage(String Message){
            //Some logging code here
        }
    }
    And then use it:
    Code:
    void fun(){
        if(ClassDebugging.IsDebug){
            ClassDebugging.LogMessage("fun called");
        }
        //some code here
        if(ClassDebugging.IsDebug){
            ClassDebugging.LogMessage("fun returned");
        }
    }
    And during release build obfuscator will optimize and remove the logging code.

    Quote Originally Posted by raj_J2ME View Post
    Hi,
    I guess that being a developer your must be aware of the exception/errors that you code might throw...why do not you try to debug the code..by the in built debugger..and even you see that what was the error..which IDE you are using?
    My application is working fine in emulator. The error I am getting is specific to data present in the phone which I cannot copy to emulator "as it is". So, I am unable to reproduce the error in emulator. I am using Netbeans IDE 6.0

  12. #12
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: Redirecting printStackTrace in Series 40 phones

    Hi,
    My application is working fine in emulator. The error I am getting is specific to data present in the phone which I cannot copy to emulator "as it is". So, I am unable to reproduce the error in emulator. I am using Netbeans IDE 6.0
    Can you explain the bold lines in details?
    what error you are getting?
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  13. #13
    Super Contributor
    Join Date
    Jan 2008
    Location
    Amravati, India
    Posts
    546

    Re: Redirecting printStackTrace in Series 40 phones

    My application is using JSR 75 PIM API and processing PIM data. I am getting exception ArrayIndexOutOfBound when I run my application on Nokia 3110c. But in emulator everything is working fine. Even when I copy all PIM data from phone to emulator then also everything is working fine. During copying, some attributes of PIM data is changed and even UID field is changed. So, I cannot reproduce the error in emulator. I want to know which line is throwing ArrayIndexOutOfBound exception when I run my application on phone. I hope you got the problem.
    Anyways, I will put logging code every now and then and find out the bug.

Similar Threads

  1. Cell ID or Location for Series 40 phones
    By warnockm in forum Mobile Java Tools & SDKs
    Replies: 2
    Last Post: 2008-11-30, 20:13
  2. Textfield bug in Series 60 phones?
    By seah_ky in forum Mobile Java General
    Replies: 1
    Last Post: 2005-10-25, 15:16
  3. Support for audio in duplex mode in Series 60 phones
    By anantakinchan in forum Symbian Media (Closed)
    Replies: 10
    Last Post: 2005-10-10, 03:32
  4. Weird problems with Series 60 phones
    By TTSoB in forum Mobile Java General
    Replies: 1
    Last Post: 2005-01-21, 16:45
  5. Replies: 2
    Last Post: 2003-03-20, 15:22

Posting Permissions

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