UserDataHelper (Apache Tomcat 10.1.48 API Documentation)
Description: declaration: package: org.apache.tomcat.util.log, class: UserDataHelper

# Class UserDataHelper

java.lang.Object
org.apache.tomcat.util.log.UserDataHelper

public class UserDataHelper extends Object
This helper class assists with the logging associated with invalid input data. A developer may want all instances of invalid input data logged to assist with debugging whereas in production it is likely to be desirable not to log anything for invalid data. The following settings may be used:

- NOTHING: Log nothing.
- DEBUG_ALL: Log all problems at DEBUG log level.
- INFO_THEN_DEBUG: Log first problem at INFO log level and any further issues in the following TBD (configurable) seconds at DEBUG level
- INFO_ALL: Log all problems at INFO log level.

By default, INFO_THEN_DEBUG is used with a suppression time of 24 hours.

NOTE: This class is not completely thread-safe. When using INFO_THEN_DEBUG it is possible that several INFO messages will be logged before dropping to DEBUG.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `UserDataHelper.Mode`
  Log mode for the next log message.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `UserDataHelper(Log log)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `UserDataHelper.Mode`
  `getNextMode()`
  Returns log mode for the next log message, or `null` if the message should not be logged.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### UserDataHelper

    public UserDataHelper(Log log)

- ## Method Details

  - ### getNextMode

    public UserDataHelper.Mode getNextMode()
    Returns log mode for the next log message, or `null` if the message should not be logged.

    If `INFO_THEN_DEBUG` configuration option is enabled, this method might change internal state of this object.

    Returns:
      Log mode, or `null`