Topic
  • 14 replies
  • Latest Post - ‏2013-08-14T12:42:52Z by rusd
EvanWorley
EvanWorley
11 Posts

Pinned topic Debugging

‏2013-02-05T18:09:39Z |
Hello, 
 
Is there anyway to debug your code? I don't imagine you can formally debug it using the debugger, but having a way to see standard output would be really useful. 
 
- Evan 
Updated on 2013-02-05T21:26:54Z at 2013-02-05T21:26:54Z by TomBanks
  • TomBanks
    TomBanks
    66 Posts

    Re: Debugging

    ‏2013-02-05T18:54:16Z  
     There is not an easy way to debug the code at the moment - to attach a debugger to the race code as it executes currently (including calls to your car AI) would need you to add a line of code in the source and recompile your own copy of coderally.jar.
     
    The security model for running races protects the machine running the server from file writes (amongst other things) and runs the race in its own process with write access to a single, unique directory on the machine. Due to this the stdout gets sent to a temporary file which gets removed once a race completes unless a hacking attempt or serious failure in the race is detected at which point all logs are retained for us to find out what happened. Would you find it useful if we had an option to copy the stdout file to a location you could specify before clearing the temp directory?  
     
    The temp directory we write to is in your user area - on Windows it would be "C:\Users\<username>\user\.coderally\temp\<unique folder>" where the unique folder is the nano time the race started at - so ordered alphabetically the last entry is the newest race. Those temp directories are deleted at race end, so if you are fast you can grab the stdout file inside (sadly not ideal).
    Updated on 2013-02-05T18:54:16Z at 2013-02-05T18:54:16Z by TomBanks
  • EvanWorley
    EvanWorley
    11 Posts

    Re: Debugging

    ‏2013-02-05T18:56:31Z  
    • TomBanks
    • ‏2013-02-05T18:49:56Z
     There is not an easy way to debug the code at the moment - to attach a debugger to the race code as it executes currently (including calls to your car AI) would need you to add a line of code in the source and recompile your own copy of coderally.jar.
     
    The security model for running races protects the machine running the server from file writes (amongst other things) and runs the race in its own process with write access to a single, unique directory on the machine. Due to this the stdout gets sent to a temporary file which gets removed once a race completes unless a hacking attempt or serious failure in the race is detected at which point all logs are retained for us to find out what happened. Would you find it useful if we had an option to copy the stdout file to a location you could specify before clearing the temp directory?  
     
    The temp directory we write to is in your user area - on Windows it would be "C:\Users\<username>\user\.coderally\temp\<unique folder>" where the unique folder is the nano time the race started at - so ordered alphabetically the last entry is the newest race. Those temp directories are deleted at race end, so if you are fast you can grab the stdout file inside (sadly not ideal).
     Yeah it would be useful to get access to the file before clearing the temp directory. Also if I remember correctly, CodeRuler did display stdout in eclipse, so I wonder if the plugin could be updated to dump the contents of that file into an "Output" panel or something?
  • TomBanks
    TomBanks
    66 Posts

    Re: Debugging

    ‏2013-02-05T19:05:32Z  
     Yeah it would be useful to get access to the file before clearing the temp directory. Also if I remember correctly, CodeRuler did display stdout in eclipse, so I wonder if the plugin could be updated to dump the contents of that file into an "Output" panel or something?
    To do that would require a few changes to what we pass around however it does bring an interesting option of storing the stdout with the race result. I do like that idea but it will have to go onto the queue of cool features to add :)
  • EvanWorley
    EvanWorley
    11 Posts

    Re: Debugging

    ‏2013-02-05T19:10:08Z  
    • TomBanks
    • ‏2013-02-05T19:05:32Z
    To do that would require a few changes to what we pass around however it does bring an interesting option of storing the stdout with the race result. I do like that idea but it will have to go onto the queue of cool features to add :)
     No problem, I figured as much. I hope I'm not annoying you with these requests. Just findings lots of features I'd like, now that I'm playing with it.
  • TomBanks
    TomBanks
    66 Posts

    Re: Debugging

    ‏2013-02-05T21:26:54Z  
     No problem, I figured as much. I hope I'm not annoying you with these requests. Just findings lots of features I'd like, now that I'm playing with it.
    no problem - it's good to get questions and requests from people looking to play the game as it means we can focus development on areas our users want - so please feel free to ask more questions/raise requests :)
  • VladS.
    VladS.
    13 Posts

    Re: Debugging

    ‏2013-08-12T13:49:22Z  
    • TomBanks
    • ‏2013-02-05T21:26:54Z
    no problem - it's good to get questions and requests from people looking to play the game as it means we can focus development on areas our users want - so please feel free to ask more questions/raise requests :)

    Any update on logging request?  You know what will be really useful to introduce a console in coderally replay client that will display logs from user car class, and make it collapsible.

    Updated on 2013-08-12T13:52:43Z at 2013-08-12T13:52:43Z by VladS.
  • TomBanks
    TomBanks
    66 Posts

    Re: Debugging

    ‏2013-08-12T15:12:14Z  
    • VladS.
    • ‏2013-08-12T13:49:22Z

    Any update on logging request?  You know what will be really useful to introduce a console in coderally replay client that will display logs from user car class, and make it collapsible.

    Unfortunately I can't give exact timelines for when the logging changes will be in the game, however I can confirm that we do have a solution planned to fix this and it is quite high on the list now.

  • TomBanks
    TomBanks
    66 Posts

    Re: Debugging

    ‏2013-08-12T15:17:00Z  
    • TomBanks
    • ‏2013-08-12T15:12:14Z

    Unfortunately I can't give exact timelines for when the logging changes will be in the game, however I can confirm that we do have a solution planned to fix this and it is quite high on the list now.

    There is a way you can see the system.out and system.err messages from your AI when running a race on a local server - inside your user directory go to <user dir>/user/.coderally/temp - in here are a list of files with numbers as the names. Each of these folders represents a race - if you look inside these there are system out and system err logs - your car's output will end up here.

    I know this isn't ideal, however it is better than nothing until the proper system out console implementation is added to the game.

    Updated on 2013-08-12T15:17:43Z at 2013-08-12T15:17:43Z by TomBanks
  • VladS.
    VladS.
    13 Posts

    Re: Debugging

    ‏2013-08-12T18:37:41Z  
    • TomBanks
    • ‏2013-08-12T15:17:00Z

    There is a way you can see the system.out and system.err messages from your AI when running a race on a local server - inside your user directory go to <user dir>/user/.coderally/temp - in here are a list of files with numbers as the names. Each of these folders represents a race - if you look inside these there are system out and system err logs - your car's output will end up here.

    I know this isn't ideal, however it is better than nothing until the proper system out console implementation is added to the game.

    Thanks this is what I need.

  • rusd
    rusd
    3 Posts

    Re: Debugging

    ‏2013-08-14T11:26:32Z  
    • TomBanks
    • ‏2013-08-12T15:17:00Z

    There is a way you can see the system.out and system.err messages from your AI when running a race on a local server - inside your user directory go to <user dir>/user/.coderally/temp - in here are a list of files with numbers as the names. Each of these folders represents a race - if you look inside these there are system out and system err logs - your car's output will end up here.

    I know this isn't ideal, however it is better than nothing until the proper system out console implementation is added to the game.

    Hi Tom, I'm not seeing any directory or files created in the temp directory:

    C:\Users\IBM_ADMIN\user\.coderally\temp

    Is there somewhere else I should be looking?

    I'm just using System.out.println to write out a debug message - is that the right mechanism?

     

  • TomBanks
    TomBanks
    66 Posts

    Re: Debugging

    ‏2013-08-14T11:54:22Z  
    • rusd
    • ‏2013-08-14T11:26:32Z

    Hi Tom, I'm not seeing any directory or files created in the temp directory:

    C:\Users\IBM_ADMIN\user\.coderally\temp

    Is there somewhere else I should be looking?

    I'm just using System.out.println to write out a debug message - is that the right mechanism?

     

    Hi Russell,

    Are you using the beta 2 code to run the races on your machine? (beta 2 was launched end of July). Also I assume you are racing on a local server and not the Code Rally cloud server?

     

    Thanks,

    Tom

  • rusd
    rusd
    3 Posts

    Re: Debugging

    ‏2013-08-14T12:02:19Z  
    • TomBanks
    • ‏2013-08-14T11:54:22Z

    Hi Russell,

    Are you using the beta 2 code to run the races on your machine? (beta 2 was launched end of July). Also I assume you are racing on a local server and not the Code Rally cloud server?

     

    Thanks,

    Tom

    Hi Tom, well I thought I was racing on a local server, but now that I look closer, I wasn't :(

    I am running the beta 2 code & have followed the instructions to set up my local server.  But when I start the server it doesn't give  all the messages so I think there is something wrong with the web server part of it.  The console output is:

    Launching RD_localserver (wlp-1.0.1.cl0120121004-1949/websphere-kernel_1.0.1) on IBM J9 VM, version pwa6470sr5-20130619_01 (SR5) (en_AU)
    [AUDIT   ] CWWKE0001I: The server RD_localserver has been launched.
    [AUDIT   ] CWWKZ0058I: Monitoring dropins for applications. 
    [AUDIT   ] CWWKF0011I: The server RD_localserver is ready to run a smarter planet.
     

    But nothing about the web application being available.  Any idea what I've done wrong?

    Thanks, Russell

  • TomBanks
    TomBanks
    66 Posts

    Re: Debugging

    ‏2013-08-14T12:16:36Z  
    • rusd
    • ‏2013-08-14T12:02:19Z

    Hi Tom, well I thought I was racing on a local server, but now that I look closer, I wasn't :(

    I am running the beta 2 code & have followed the instructions to set up my local server.  But when I start the server it doesn't give  all the messages so I think there is something wrong with the web server part of it.  The console output is:

    Launching RD_localserver (wlp-1.0.1.cl0120121004-1949/websphere-kernel_1.0.1) on IBM J9 VM, version pwa6470sr5-20130619_01 (SR5) (en_AU)
    [AUDIT   ] CWWKE0001I: The server RD_localserver has been launched.
    [AUDIT   ] CWWKZ0058I: Monitoring dropins for applications. 
    [AUDIT   ] CWWKF0011I: The server RD_localserver is ready to run a smarter planet.
     

    But nothing about the web application being available.  Any idea what I've done wrong?

    Thanks, Russell

    Hi Russell,

    Have you imported the CodeRallyServer project into eclipse, and then dragged it onto the server in the servers view? This will deploy the application onto your local machine.

    Thanks,

    Tom

  • rusd
    rusd
    3 Posts

    Re: Debugging

    ‏2013-08-14T12:42:52Z  
    • TomBanks
    • ‏2013-08-14T12:16:36Z

    Hi Russell,

    Have you imported the CodeRallyServer project into eclipse, and then dragged it onto the server in the servers view? This will deploy the application onto your local machine.

    Thanks,

    Tom

    Got it working - thanks Tom.

    Great project by the way!