How to print log in a java class in server.

Post here your questions about the Java client / Android API for SFS2X

Moderators: Lapo, Bax

hoanghuybao
Posts: 35
Joined: 22 Aug 2015, 16:20

How to print log in a java class in server.

Postby hoanghuybao » 21 Feb 2016, 11:26

Hi admin,

How to print log in a java class in server. I reseach and try with an example but it don't work.
private final Logger m_log;

public ChessGameBoard() {
m_log = LoggerFactory.getLogger("com.xdevteam.chess.ChessGameBoard");
....
}

public boolean methodA() {
m_log.info("It should be displayed in server.log");
}
Please give me some solutions.
Cheer,
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: How to print log in a java class in server.

Postby Lapo » 21 Feb 2016, 12:23

Hi,
in your main Extension class and all other Request and Event handlers you can simply call trace(...)

example:

Code: Select all

trace("Hello... this is a log message");

This will show up in the server logs.

If you want to customize your logging you can read this article:
http://smartfoxserver.com/blog/?p=416

cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
hoanghuybao
Posts: 35
Joined: 22 Aug 2015, 16:20

Re: How to print log in a java class in server.

Postby hoanghuybao » 21 Feb 2016, 12:48

Thanks Lapo very much. :D

Return to “SFS2X Java / Android API”

Who is online

Users browsing this forum: No registered users and 4 guests