Admin tool Log Viewer custom file load

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

Mrm83
Posts: 155
Joined: 17 Dec 2017, 04:02

Admin tool Log Viewer custom file load

Postby Mrm83 » 07 Nov 2022, 14:45

Is it possible to load a custom log file for viewing from the admin tool?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Admin tool Log Viewer custom file load

Postby Lapo » 07 Nov 2022, 15:01

Hi,
no, it's not possibile.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Admin tool Log Viewer custom file load

Postby Lapo » 07 Nov 2022, 15:05

However, you may want to check this part of the documentation:
http://docs2x.smartfoxserver.com/Gettin ... om-modules

if you're interested in building a custom AdminTool to view your log files.

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
Mrm83
Posts: 155
Joined: 17 Dec 2017, 04:02

Re: Admin tool Log Viewer custom file load

Postby Mrm83 » 14 Nov 2022, 19:55

thanks, this is very helpful.
Mrm83
Posts: 155
Joined: 17 Dec 2017, 04:02

Re: Admin tool Log Viewer custom file load

Postby Mrm83 » 02 Mar 2023, 14:24

I just started implementing my own gm handler and im running into issue.

once deploying the jar to the __lib__ directory, the server will not boot correctly. it keeps on rebooting indefinitly and i see no error. once i move the jar out of __lib__, server will boot fine and i see this

Code: Select all

02 Mar 2023 | 09:37:48,611 | WARN  | main | Extensions |     | {Admin}: Request handler for Administration Tool's 'GM' custom module can't be loaded due to the previous error; module discarded
02 Mar 2023 | 09:37:48,611 | WARN  | main | Extensions |     | {Admin}: SVG icon for module 'GM' is not available



my handler is basic and barebone.

Code: Select all

package GM;

import com.smartfoxserver.v2.admin.handlers.requests.BaseAdminModuleReqHandler;
import com.smartfoxserver.v2.annotations.Instantiation;
import com.smartfoxserver.v2.annotations.MultiHandler;
import com.smartfoxserver.v2.entities.User;
import com.smartfoxserver.v2.entities.data.ISFSObject;
import com.smartfoxserver.v2.extensions.SFSExtension;

@MultiHandler
@Instantiation(Instantiation.InstantiationMode.SINGLE_INSTANCE)
public class GameManagerReqHandler extends BaseAdminModuleReqHandler
{
    public static final String MODULE_ID = "GameManager";
    private static final String COMMANDS_PREFIX = "gameMan";
 
    public GameManagerReqHandler()
    {
        super(COMMANDS_PREFIX, MODULE_ID);
    }
 
    @Override
    protected void handleAdminRequest(User sender, ISFSObject params)
    {
        String cmd = params.getUtfString(SFSExtension.MULTIHANDLER_REQUEST_ID);
        trace ("cmd");
    }
}
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Admin tool Log Viewer custom file load

Postby Bax » 02 Mar 2023, 15:40

The logged error mentions a previous error causing the module to be discarded.
Is there another error reported in the logs before that line?
Paolo Bax
The SmartFoxServer Team
Mrm83
Posts: 155
Joined: 17 Dec 2017, 04:02

Re: Admin tool Log Viewer custom file load

Postby Mrm83 » 02 Mar 2023, 17:08

There is no error, just keep restarting by itself.
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Admin tool Log Viewer custom file load

Postby Bax » 03 Mar 2023, 08:54

Can you please post the module declaration in your AdminTool.xml file?
Paolo Bax
The SmartFoxServer Team
Mrm83
Posts: 155
Joined: 17 Dec 2017, 04:02

Re: Admin tool Log Viewer custom file load

Postby Mrm83 » 03 Mar 2023, 12:35

<module id="GameManager" name="Game Manager" description="Game management tools" className="GM.GameManagerReqHandler"/>
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Admin tool Log Viewer custom file load

Postby Bax » 03 Mar 2023, 13:04

We tested your class and setup and everything works as expected.
Make sure your jar file is generated correctly, and it contains the "GM/GameManagerReHandler.class" folder/file.
Paolo Bax
The SmartFoxServer Team
Mrm83
Posts: 155
Joined: 17 Dec 2017, 04:02

Re: Admin tool Log Viewer custom file load

Postby Mrm83 » 03 Mar 2023, 16:12

Its valid jar.

Please confirm my setup.
build jar file as whatever.jar and move it to __lib__ dir
add module to admintool.xml
duplicate icon.svg and rename it to the module id.svg
reboot server
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Admin tool Log Viewer custom file load

Postby Bax » 03 Mar 2023, 16:42

Yes, we tested in version 2.18 too, and it works fine.
You should check if your jar contains the class only, or if it also contains dependancies (which shouldn't).
At this url you can get our test project, which also includes our jar file to be deployed to extensions/__lib__:
http://www.smartfoxserver.com/temp/cust ... e_test.zip
Paolo Bax
The SmartFoxServer Team
Mrm83
Posts: 155
Joined: 17 Dec 2017, 04:02

Re: Admin tool Log Viewer custom file load

Postby Mrm83 » 03 Mar 2023, 18:33

ok, this is very weird. your version of the jar works.
i copied your java and rebuilt and it fails for me.
the structure of both jars are identical..

im stumped.
Attachments
Screen Shot 2023-03-03 at 1.43.16 PM.png
(169.05 KiB) Not downloaded yet
Mrm83
Posts: 155
Joined: 17 Dec 2017, 04:02

Re: Admin tool Log Viewer custom file load

Postby Mrm83 » 03 Mar 2023, 18:41

Ok, i found the problem. Not sure why it is, but after changing the project's JRE System Library from JavaSE-17 to JavaSE-1.8 fixed the issue.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Admin tool Log Viewer custom file load

Postby Lapo » 04 Mar 2023, 08:30

You don't have to change the JDK necessarily, you just need to configure the compiler to produce Java 8 compatible bytecode (Java 11 is also fine).

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 53 guests