ray.serve.schema.LoggingConfig#

pydantic model ray.serve.schema.LoggingConfig[source]#

Logging config schema for configuring serve components logs.

Example

from ray import serve
from ray.serve.schema import LoggingConfig
# Set log level for the deployment.
@serve.deployment(LoggingConfig(log_level="DEBUG"))
class MyDeployment:
    def __call__(self) -> str:
        return "Hello world!"
# Set log directory for the deployment.
@serve.deployment(LoggingConfig(logs_dir="/my_dir"))
class MyDeployment:
    def __call__(self) -> str:
        return "Hello world!"

PublicAPI (alpha): This API is in alpha and may change before becoming stable.

field additional_log_standard_attrs: List[str] [Optional]#

Default attributes from the Python standard logger that will be added to all log records. See https://docs.python.org/3/library/logging.html#logrecord-attributes for a list of available attributes.

field enable_access_log: bool = True#

Whether to enable access logs for each request. Default to True.

field encoding: str | EncodingType [Optional]#

Encoding type for the serve logs. Defaults to ‘TEXT’. The default can be overwritten using the RAY_SERVE_LOG_ENCODING environment variable. ‘JSON’ is also supported for structured logging.

field log_level: int | str = 'INFO'#

Log level for the serve logs. Defaults to INFO. You can set it to ‘DEBUG’ to get more detailed debug logs.

field logs_dir: str | None = None#

Directory to store the logs. Default to None, which means logs will be stored in the default directory (‘/tmp/ray/session_latest/logs/serve/…’).

validator valid_additional_log_standard_attrs  »  additional_log_standard_attrs[source]#
validator valid_encoding_format  »  encoding[source]#
validator valid_log_level  »  log_level[source]#