Repository navigation
Debugging
If you're unsure about what's happening within the API or need additional information to troubleshoot a problem or error, the internal debugging tool provided by the TS-API is your solution.
Your solution is the internal debugging Tool provided by the TS-API:
This works simply by using the QueryConfig Class with the getter in the Ts3ServerQuery Class.
By adding Enums with in the addDebugItem Method to the Debug List you can exactly choose what Type of Actions done by the API you want to see.
DebugOutputType Enum (List of Enums to choose from):
public enum DebugOutputType {
EVERYTHING,
GENERAL,
EVENTMANAGER,
KEEPALIVETHREAD,
QUERY,
QUERYREADER,
QUERYWRITER,
ERROR,
WARNING,
QUERYREADERQUEUE,
CACHEMANAGER,
E_CHANNEL_CREATED,
E_CHANNEL_DELETED,
E_CHANNEL_DESCRIPTION_EDITED,
E_CHANNEL_EDITED,
E_CHANNEL_PASSWORD_CHANGED,
E_CHANNEL_MOVED,
E_CLIENT_JOIN,
E_CLIENT_LEAVE,
E_CLIENT_MOVE,
E_PRIVILEGEKEY_USED,
E_SERVER_EDITED,
E_TEXT_MESSAGE;
}Selecting which Type of Debug you want to see:
(Specifying which Actions done by the API you want to be logged)
// To select everything to be debugged
query.getConfig().addDebugItem(DebugOutputType.EVERYTHING);
// General information
query.getConfig().addDebugItem(DebugOutputType.GENERAL);
// Shows which EventListener was added/removed or which Event was called
query.getConfig().addDebugItem(DebugOutputType.EVENTMANAGER);
// Information about the KeepAliveThread
query.getConfig().addDebugItem(DebugOutputType.KEEPALIVETHREAD);
// General query information
query.getConfig().addDebugItem(DebugOutputType.QUERY);
// Query reading incoming packets and events
query.getConfig().addDebugItem(DebugOutputType.QUERYREADER);
// Query queue management for packets
query.getConfig().addDebugItem(DebugOutputType.QUERYREADERQUEUE);
// Query outputs and executed commands
query.getConfig().addDebugItem(DebugOutputType.QUERYWRITER);
// Actions done by the cache manager
query.getConfig().addDebugItem(DebugOutputType.CACHEMANAGER);Select which Type of Event related debug you want to see in your Debug-Log:
Note: EventManager must not be enabled to see specified Events
// Debugs the information of the called Event
// Using the Prefix "E_"
query.getConfig().addDebugItem(DebugOutputType.E_CHANNEL_CREATED);
query.getConfig().addDebugItem(DebugOutputType.E_CHANNEL_DELETED);
query.getConfig().addDebugItem(DebugOutputType.E_CHANNEL_DESCRIPTION_EDITED);
query.getConfig().addDebugItem(DebugOutputType.E_CHANNEL_EDITED);
query.getConfig().addDebugItem(DebugOutputType.E_CHANNEL_MOVED);
query.getConfig().addDebugItem(DebugOutputType.E_CHANNEL_PASSWORD_CHANGED);
query.getConfig().addDebugItem(DebugOutputType.E_CLIENT_JOIN);
query.getConfig().addDebugItem(DebugOutputType.E_CLIENT_LEAVE);
query.getConfig().addDebugItem(DebugOutputType.E_CLIENT_MOVE);
query.getConfig().addDebugItem(DebugOutputType.E_PRIVILEGEKEY_USED);
query.getConfig().addDebugItem(DebugOutputType.E_SERVER_EDITED);
query.getConfig().addDebugItem(DebugOutputType.E_TEXT_MESSAGE);Select which Type of Display you want for your Debug-Log:
// Debugs in both file and console
query.getConfig().setDebugType(DebugType.BOTH);
// Debugs only in console (default setting)
query.getConfig().setDebugType(DebugType.CONSOLE);
// Debugs only in a file (location: /Logs/<YYYY.MM.dd>.txt)
query.getConfig().setDebugType(DebugType.FILE);Select more Information in your Debug-Log:
// Logs milliseconds in time
query.getConfig().setShowTimeMilliseconds(true);
// Logs the current date
query.getConfig().setShowDate(true);You have the flexibility to adjust these settings dynamically within your running code, allowing for adaptable debugging strategies.
It's advisable to avoid using QUERYREADER and QUERYREADERQUEUE simultaneously, as they both provide similar debug information regarding incoming packets. The same caution applies to enabling the EVERYTHING debug type, as it includes both of these options.
- QUERYREADER logs incoming packets and event calls.
- QUERYREADERQUEUE logs incoming packets, their removal and the time a command is send to the server if FloodRate is more than zero.
Furthermore, if you opt to utilize these debug types, bear in mind that your log files may become extensive. This is primarily due to the length of packets generated by methods like getClientInfo, getClients, getChannelInfo, getChannels, getServerGroups, and getVirtualServerInfo, as well as the frequent invocation of these basic methods.
Refer to the ExampleDebugLog file for further details.
(See: Select more Information in your Debug-Log:)
[THREAD] [TIME] [TYPE OF INFORMATION] : INFORMATION
[THREAD] [HH:mm:ss] [TYPE OF INFORMATION] : INFORMATIONExample:
[main] [14:33:50] [QUERY READER] : Starting listening in QueryReader[THREAD] [DATE] [TIME] [TYPE OF INFORMATION] : INFORMATION
[THREAD] [DD/MM/YYYY] [HH:mm:ss.SSS] [TYPE OF INFORMATION] : INFORMATIONExample:
[main] [01/04/2023] [14:33:50.800] [QUERY READER] : Starting listening in QueryReader- main = Mainthread
- KALT = KeepAliveThread
- QURT = QueryReaderThread
- EVMA = EventManager
- ASYN = Asynchronous
- CHMA = ChacheManager