This is a documentation for Board Game Arena: play board games online !

Studio logs: Difference between revisions

From Board Game Arena
Jump to navigation Jump to search
No edit summary
 
(13 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{Studio_Framework_Navigation}}


BGA Studio logs are available directly from your game development interface.
Logs allows you to check out what happened recently on server and to debug your game.


Logs allows you to check out what happened recently on server and to debug your game.
BGA Studio logs are available directly from your game development interface. You can also navigate to them: https://studio.boardgamearena.com/1/mygame/mygame/logaccess.html?table=######, where you replace mygame and ###### accordingly.


== BGA request&SQL logs ==
== BGA request&SQL logs ==
This log is useful:
* When you want to check what SQL requests has been built during a request.
* When you want to debug your PHP code using "self::trace"
* When you want to know why a request takes too much time.


On this log, you can see:
On this log, you can see:
Line 25: Line 32:


Let's details the beginning of the log:
Let's details the beginning of the log:
* 20/06 21:50:56: the date
* 20/06 21:50:56: the date
* [notice]
* [notice]
* [T403]: this is a log from table 403
* [T403]: this is a log from table 403
* [4/mytest0]: this is use "mytest0", with id 4
* [4/mytest0]: this is use "mytest0", with id 4
* OK-0: it means that the request ended up successfully, with no exception (expected or unexpected).
* OK-0: it means that the request ended up successfully, with no exception (expected or unexpected).
* 169: this is the time taken to process the request (169ms).
* 169: this is the time taken to process the request (169ms).
* d141: this is the total Database time used to process the request (141ms).
* d141: this is the total Database time used to process the request (141ms).
 
=== SQL requests ===
 
Example:
  20/06 21:50:56 [info] [T403] [4/mytest0] 0.26 SELECT player_tokenColor FROM player WHERE player_id ='4'
 
All requests to Database are traced in this log. You can see here the time take by the request (0,26ms).
 
=== Custom trace ===
 
You can use special PHP methods in your PHP code to left some trace in this log:
* $this->trace( "your message here" );    // Display "your message here" in the log
* $this->dump( "My variable", $variable_to_dump );  // Display the content of $variable_to_dump in the log
 
== BGA unexpected exceptions logs ==
 
In this log you can check the last Unexpected exceptions from your game.
 
Exceptions management on PHP side [[http://en.doc.boardgamearena.com/Main_game_logic:_yourgamename.game.php#Managing_errors_and_exceptions is described here]].
 
The log displayed the complete stacktrace of the exception, so you can debug it.
 
The SQL log is very verbose and sometimes it too hard to extract your tracing from it, in this case you can use error log for tracing temporarily.
You can add debug statement using self::warn() which will appear in that the log. Do not leave these tracing method calls after you done debugging unless they
are real warnings or errors (only the error log level will appear in production).
 
== BGA Production Logs ==
 
=== How to access production server exception logs ===
 
# Navigate to your game page on the Studio website
## e.g. <nowiki>https://studio.boardgamearena.com/studiogame?game=YOURGAMEID</nowiki>
# Scroll to the bottom of the page
# Click the `Display recent errors from production` button
## [[File:How-to-access-bga-production-server-logs.png|500px]]
 
 
 
[[Category:Studio]]

Latest revision as of 23:55, 7 May 2024


Game File Reference



Useful Components

Official

  • Deck: a PHP component to manage cards (deck, hands, picking cards, moving cards, shuffle deck, ...).
  • Draggable: a JS component to manage drag'n'drop actions.
  • Counter: a JS component to manage a counter that can increase/decrease (ex: player's score).
  • ExpandableSection: a JS component to manage a rectangular block of HTML than can be displayed/hidden.
  • Scrollmap: a JS component to manage a scrollable game area (useful when the game area can be infinite. Examples: Saboteur or Takenoko games).
  • Stock: a JS component to manage and display a set of game elements displayed at a position.
  • Zone: a JS component to manage a zone of the board where several game elements can come and leave, but should be well displayed together (See for example: token's places at Can't Stop).

Undocumented component (if somebody knows please help with docs)

  • Wrapper: a JS component to wrap a <div> element around its child, even if these elements are absolute positioned.

Unofficial



Game Development Process



Guides for Common Topics



Miscellaneous Resources

Logs allows you to check out what happened recently on server and to debug your game.

BGA Studio logs are available directly from your game development interface. You can also navigate to them: https://studio.boardgamearena.com/1/mygame/mygame/logaccess.html?table=######, where you replace mygame and ###### accordingly.

BGA request&SQL logs

This log is useful:

  • When you want to check what SQL requests has been built during a request.
  • When you want to debug your PHP code using "self::trace"
  • When you want to know why a request takes too much time.


On this log, you can see:

Your requests

Example:

 20/06 21:50:56 [info] [T403] [4/mytest0] /cinco/cinco/exchange4Cards.html?id=4&lock=97d1c7a1-903a-4d1f-8206-de39ce8204fc&table=403&testuser=4&dojo.preventCache=1371757856044

Note that the best way to check your Ajax request is to read the [Input/Output section].

Request responses

Example:

 20/06 21:50:56 [notice] [T403] [4/mytest0] OK-0 169 d141 c8 e0 I9 A158 V0 T0 /cinco/cinco/exchange4Cards.html?id=4&lock=97d1c7a1-903a-4d1f-8206-de39ce8204fc&table=403&testuser=4&dojo.preventCache=1371757856044

You can recognize a response because it contains [notice]. Usually, there is one response for each request.

Let's details the beginning of the log:

  • 20/06 21:50:56: the date
  • [notice]
  • [T403]: this is a log from table 403
  • [4/mytest0]: this is use "mytest0", with id 4
  • OK-0: it means that the request ended up successfully, with no exception (expected or unexpected).
  • 169: this is the time taken to process the request (169ms).
  • d141: this is the total Database time used to process the request (141ms).

SQL requests

Example:

 20/06 21:50:56 [info] [T403] [4/mytest0] 0.26 SELECT player_tokenColor FROM player WHERE player_id ='4'

All requests to Database are traced in this log. You can see here the time take by the request (0,26ms).

Custom trace

You can use special PHP methods in your PHP code to left some trace in this log:

  • $this->trace( "your message here" ); // Display "your message here" in the log
  • $this->dump( "My variable", $variable_to_dump ); // Display the content of $variable_to_dump in the log

BGA unexpected exceptions logs

In this log you can check the last Unexpected exceptions from your game.

Exceptions management on PHP side [is described here].

The log displayed the complete stacktrace of the exception, so you can debug it.

The SQL log is very verbose and sometimes it too hard to extract your tracing from it, in this case you can use error log for tracing temporarily. You can add debug statement using self::warn() which will appear in that the log. Do not leave these tracing method calls after you done debugging unless they are real warnings or errors (only the error log level will appear in production).

BGA Production Logs

How to access production server exception logs

  1. Navigate to your game page on the Studio website
    1. e.g. https://studio.boardgamearena.com/studiogame?game=YOURGAMEID
  2. Scroll to the bottom of the page
  3. Click the `Display recent errors from production` button
    1. How-to-access-bga-production-server-logs.png