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

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

How to print log in a java class in server.

Post 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,
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

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

Post 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
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.

Post by hoanghuybao »

Thanks Lapo very much. :D
Post Reply