Class ApiUsageLogger
Logs at Level.FINEST by default, so messages are silent in production unless
explicitly enabled. Each log record includes a Throwable to make the offending call site
visible in the stack trace without requiring the exception to be thrown.
The first time any API misuse is detected, a one-time Level.WARNING is emitted to the
io.opentelemetry.usage logger. This warning is visible under default logging
configuration and signals that API misuse is occurring. To see the full details of every misuse
event (message and stack trace), configure the io.opentelemetry.usage logger at Level.FINEST.
This class is not intended for use by application developers. Its API is stable and will not be changed or removed in a backwards-incompatible manner.
- Since:
- 1.62.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidlogNullParam(Class<?> apiClass, String methodName, String paramName) Log thatparamNamewas null inapiClass#methodName.static voidlogUsageIssue(Class<?> apiClass, String methodName, String message) Log a misuse ofapiClass#methodNamewith the givenmessage.
-
Method Details
-
logNullParam
Log thatparamNamewas null inapiClass#methodName.Convenience overload of
logUsageIssue(Class, String, String)for the common case of a null parameter that should not be null.- Parameters:
apiClass- the public API class where the misuse occurredmethodName- the name of the method where the misuse occurredparamName- the name of the parameter that was null
-
logUsageIssue
Log a misuse ofapiClass#methodNamewith the givenmessage.Logs at
Level.FINESTand includes a stack trace.- Parameters:
apiClass- the public API class where the misuse occurredmethodName- the name of the method where the misuse occurredmessage- a brief description of the problem
-