Page 1 of 1

Seeing startup logs

Posted: 16 May 2020, 03:16
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?

Re: Seeing startup logs

Posted: 16 May 2020, 15:01
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

Re: Seeing startup logs

Posted: 16 May 2020, 17:32
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.)

Re: Seeing startup logs

Posted: 16 May 2020, 20:17
by Victoria_La
Check this "I am really stuck" wiki, your error is actually 1.1 case

http://en.doc.boardgamearena.com/Troubleshooting

Re: Seeing startup logs

Posted: 19 May 2020, 16:16
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.

Re: Seeing startup logs

Posted: 19 May 2020, 16:55
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".

Re: Seeing startup logs

Posted: 19 May 2020, 21:05
by Guicide
I have done that. No self::trace has ever appeared.

Re: Seeing startup logs

Posted: 25 May 2020, 02:47
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