Seeing startup logs

Game development with Board Game Arena Studio
Post Reply
User avatar
RavingWanderer
Posts: 83
Joined: 12 May 2020, 16:08

Seeing startup logs

Post by RavingWanderer »

I'm trying to diagnose problems in starting my game. In a number of cases the proximate error is displayed in the General Messages window, but this is by itself insufficient to diagnose the root cause. (For example, a recent problem I'm trying to work past includes the following diagnostic: Undefined offset: 0 in /var/tournoi/release/tournoi-200512-1144-gs/www/game/module/table/table.game.php on line 1086. This is presumably due a problem in my code, but this message is not useful for finding it, since it is thrown in BGA code, and there is not even a stack trace accompanying the message.)

I have placed trace messages in my startup code to provide additional diagnostic information, but I am unable to see the game log because the board, where the toolbar for seeing is, never comes up. Is there a place outside the game board where the log for the most recent game can be seen? Should the dev toolbar be accessible on the configure table page?
User avatar
Benoit314
Posts: 82
Joined: 02 April 2020, 22:12

Re: Seeing startup logs

Post by Benoit314 »

I think you can open your link for the log and just change the table id.

https://studio.boardgamearena.com/1/you ... ble=gameId
User avatar
RavingWanderer
Posts: 83
Joined: 12 May 2020, 16:08

Re: Seeing startup logs

Post by RavingWanderer »

That link is useful to have, thank you. (It should probably be mentioned at http://en.doc.boardgamearena.com/Studio_logs as a way to directly access those logs.)
User avatar
Victoria_La
Posts: 665
Joined: 28 December 2015, 20:55

Re: Seeing startup logs

Post by Victoria_La »

Check this "I am really stuck" wiki, your error is actually 1.1 case

http://en.doc.boardgamearena.com/Troubleshooting
Guicide
Posts: 7
Joined: 05 May 2020, 21:37

Re: Seeing startup logs

Post by Guicide »

I have a similar problem.
My code gets further, but I’d like to be able to use self::trace and self::dump in MYGAME.game.php to help my understanding of the functions.

I tried the simple case of:

Code: Select all

protected function setupNewGame( $players, $options = array() )
    {
    self::trace("setupNewGame() was called");
and I cannot figure out where I should see the trace.
User avatar
Benoit314
Posts: 82
Joined: 02 April 2020, 22:12

Re: Seeing startup logs

Post by Benoit314 »

In game, you have 3 buttons on the bottom of your game ("Go to game Database", etc.), click on "BGA request & SQL logs".
Guicide
Posts: 7
Joined: 05 May 2020, 21:37

Re: Seeing startup logs

Post by Guicide »

I have done that. No self::trace has ever appeared.
Guicide
Posts: 7
Joined: 05 May 2020, 21:37

Re: Seeing startup logs

Post by Guicide »

Here's my workaround:

in mygame.game.php:
function spew($txt) // better not contain single quotes
{
if ($this->inStudio)
self::DbQuery("SELECT '" . $txt . "!' AS SPEW");
}

protected function getAllDatas()
{
self::spew("getAllDatas() was called");
...

Then, after running my game, the "BGA request&SQL logs" contains:
25/05 03:39:04 [info] [T152943] [2324822/GuicideDev0] 0.11205673217773 SELECT player_id,player_enter_game FROM player WHERE player_id='2324822'2
25/05 03:39:04 [info] [T152943] [2324822/GuicideDev0] 2.9458999633789 UPDATE player SET player_enter_game='1' WHERE player_id='2324822' 2
25/05 03:39:04 [info] [T152943] [2324822/GuicideDev0] 0.053882598876953 SELECT 'getAllDatas() was called!' AS SPEW2
25/05 03:39:04 [info] [T152943] [2324822/GuicideDev0] 0.16403198242188 SELECT player_id id, player_score score, bid bid, pointsTaken pointsTaken FROM player WHERE 1 2
25/05 03:39:04 [info] [T152943] [2324822/GuicideDev0] 0.18882751464844 SELECT card_id id, card_type type, card_type_arg type_arg, card_location location, card_location_arg location_arg FROM card WHERE card_location='hand' AND
Post Reply

Return to “Developers”