Class PanelConnectionLog
Why the mark exists. The panel answers a message it rejects with an error reply,
and it counts the rejected message against the client's quota (50 messages in 10 seconds). The
framework used to log each error reply as a SEVERE line through the shared plugin logger;
the log stream sent that line to the panel, the panel rejected it as over quota and replied with
another error. Measured on a real server with ultipanel.logging.batch.enabled:
false: 42,066 "Rate limit exceeded" lines in one run. SystemLogHandler's same-thread
guard cannot stop this, because each reply is a separate inbound message, and its logger-name
filter cannot either, because every line logged through the shared plugin logger carries that
logger's name.
What it covers. Every line whose text comes from the panel connection or describes it: the panel's replies and notifications, inbound messages the framework cannot use, the client's connect, disconnect, heartbeat and reconnect lines, and the warnings about a message that could not be sent. Lines about work the panel asked for (a command, a file operation) are not connection lines and stay on the stream.
How. The line is logged through the plugin logger as before -- so it reaches the console
with the plugin's own [UltiTools] prefix and at its real level -- but as a record of a
private LogRecord subclass. SystemLogHandler never hands a record for which
isPanelConnectionRecord(LogRecord) is true to the stream (its error report for a SEVERE
record with an exception still runs), and EarlyLogCapture does not keep one. Paper's
plugin logger hands the same record object to every handler up the logger chain, so the mark
survives the trip to the root logger. A dedicated logger was not used because the console prints
a record's logger name as its bracketed prefix, so these lines would lose the [UltiTools]
prefix operators search for.
- Since:
- 6.3.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classThe mark: a record of this type is a panel-connection line. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisPanelConnectionRecord(LogRecord record) Whetherrecordwas written by this class, and so must not be sent to the panel.static voidLogs a panel-connection line through the plugin logger.static voidLogs a panel-connection line, with its exception, through the plugin logger.
-
Constructor Details
-
PanelConnectionLog
private PanelConnectionLog()
-
-
Method Details
-
log
Logs a panel-connection line through the plugin logger.- Parameters:
level- the levelmessage- the text, already formatted
-
log
Logs a panel-connection line, with its exception, through the plugin logger. Nothing is written when the plugin instance or its logger is not available (a call before the plugin is enabled, or a unit test without one).- Parameters:
level- the levelmessage- the text, already formattedthrown- the exception, ornull
-
isPanelConnectionRecord
Whetherrecordwas written by this class, and so must not be sent to the panel.- Parameters:
record- the record, possiblynull- Returns:
- whether it is a panel-connection line
-