My extensions use some utility classes, and I want these utility classes to be able to log to the smartfoxserver.log as well.
How can I access the trace function or redirect my stdout to the log file?
Accessing "trace()" function outside of extension
Re: Accessing "trace()" function outside of extension
Hello,
One option is to store a static instance of your extension's main class and then everytime you want to trace anything to the console, you retrieve that instance and call the appropriate method.
Another one is to directly access the logger, if I'm not mistaken, you can use the Logger.getLogger("SmartFoxServer") command for retrieving SFS's logger.
Cheers
One option is to store a static instance of your extension's main class and then everytime you want to trace anything to the console, you retrieve that instance and call the appropriate method.
Another one is to directly access the logger, if I'm not mistaken, you can use the Logger.getLogger("SmartFoxServer") command for retrieving SFS's logger.
Cheers
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Re: Accessing "trace()" function outside of extension
is it from the java.util.logging package?
Re: Accessing "trace()" function outside of extension
Hello,
Yes you can use that Logger. And retrieve the logger for SmartFoxServer's class "it.gotoandplay.smartfoxserver.SmartFoxServer".
But as this logger is more reserved to the server-side API, I'd really suggest to go the first way I explained on my previous post, by exposing an instance of your extension and then logging through it.
Cheers
Yes you can use that Logger. And retrieve the logger for SmartFoxServer's class "it.gotoandplay.smartfoxserver.SmartFoxServer".
But as this logger is more reserved to the server-side API, I'd really suggest to go the first way I explained on my previous post, by exposing an instance of your extension and then logging through it.
Cheers
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.