This project has moved. For the latest updates, please go here.

Unable to get log entries

May 10, 2012 at 9:49 AM

Hi,

i need to get all log entries from the selected virtual server. But after executing QueryRunner.GetLogEntries() the application hangs and ends up with the following exception:

TargetInvocationException:
Could not cast parameter with name 'timestamp' and value '' to target type of 'System.UInt64'.

Code:

void QueryDispatcher_ReadyForSendingCommands(object sender, EventArgs e)
{
    QueryRunner = new QueryRunner(QueryDispatcher);

    VersionResponse version = QueryRunner.GetVersion();
    if (!version.IsErroneous)
    {
        if (!QueryRunner.Login("serveradmin", "#####").IsErroneous)
        {
            QueryRunner.SelectVirtualServerByPort(9987);
            ListResponse<ChannelListEntry> channels = QueryRunner.GetChannelList();
            ListResponse<LogEntry> logEntries = QueryRunner.GetLogEntries(10);
        }
    }
}

I am using server version 3.0.5 on debian squeeze (6.0).

Coordinator
May 10, 2012 at 9:00 PM

Will have a look at it now..

Coordinator
May 10, 2012 at 10:27 PM
Edited May 10, 2012 at 10:39 PM

Hello,

the dev team seems to have changed the api there silently. I changed the code and checked it in. You can build your new version --> Releases\V_1_0_5_1

Anyway the api of TS3 seems to have a bug regarding the "begin_pos" parameter. I think it should be the start index of the line but the api takes it as the end index of the whole log file. This does not make any sense to me.

 

See: http://forum.teamspeak.com/showthread.php/73797-Logview-using-the-queryport-gt-How-to-retrieve-all-Log-Entries

May 11, 2012 at 7:57 AM
Edited May 11, 2012 at 7:58 AM

Hi,

thank you for the fast response and for this awesome library. I really hope that it will get updated for further ts3 server versions ;)

With 1.0.5.1 my application does not crash anymore. But it seems that it does not fetch any log entries from virtual servers. Instead it only fetches log entries from the master logfile. I've tried both overloads, but i cannot recognize any differences.

Code:

QueryRunner.SelectVirtualServerById(9998);
LogViewResponse logEntries = QueryRunner.GetLogEntries(100);

The server instance with port 9998 has just one log entry. Therefore the result should be something like that:
2012-05-11 08:24:29.010578|WARNING |Variables     |3   | listening on 0.0.0.0:9998

But it is:
2012-05-11 08:24:29.010578|WARNING |Variables     |   | loadFromDatabase() found unregistered ident: virtualserver_antiflood_points_needed_warning
2012-05-11 08:24:29.010615|WARNING |Variables     |   | loadFromDatabase() found unregistered ident: virtualserver_antiflood_points_needed_kick
2012-05-11 08:24:29.010646|WARNING |Variables     |   | loadFromDatabase() found unregistered ident: virtualserver_antiflood_points_needed_ban

... which is fetched from the master log file, since it does not have a server id assigned.

I am signed in as serveradmin.

Regards,
fs86

Coordinator
May 15, 2012 at 10:35 AM
Edited May 15, 2012 at 10:37 AM

Hello fs86,

 

sorry for the late response. The Problem why you are getting the master log entries is, that you have a mistake in your code:

QueryRunner.SelectVirtualServerById(9998);

You should have specified the Id in the code above ^^ but you specified the port ;)
If you want to select the server by port use the correct method :)

Despite the fact, I changed the methods again and added a new method to ease the pain of getting all log entries: GetAllLogEntries

Regards,
Sco

May 15, 2012 at 1:22 PM

Oh damn ...

yes, you are right. Sorry for the false report then. I will test the new version asap :)
Thanks for your response.

Regards,
fs86