Page 1 of 1

How to print log in a java class in server.

Posted: 21 Feb 2016, 11:26
by hoanghuybao
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,

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

Posted: 21 Feb 2016, 12:23
by Lapo
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

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

Posted: 21 Feb 2016, 12:48
by hoanghuybao
Thanks Lapo very much. :D