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.
Show JSON schema
{ "title": "LoggingConfig", "description": "Logging config schema for configuring serve components logs.\n\nExample:\n\n .. code-block:: python\n\n from ray import serve\n from ray.serve.schema import LoggingConfig\n # Set log level for the deployment.\n @serve.deployment(LoggingConfig(log_level=\"DEBUG\")\n class MyDeployment:\n def __call__(self) -> str:\n return \"Hello world!\"\n # Set log directory for the deployment.\n @serve.deployment(LoggingConfig(logs_dir=\"/my_dir\")\n class MyDeployment:\n def __call__(self) -> str:\n return \"Hello world!\"\n\n**PublicAPI (alpha):** This API is in alpha and may change before becoming stable.", "type": "object", "properties": { "encoding": { "title": "Encoding", "description": "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.", "anyOf": [ { "type": "string" }, { "$ref": "#/definitions/EncodingType" } ] }, "log_level": { "title": "Log Level", "description": "Log level for the serve logs. Defaults to INFO. You can set it to 'DEBUG' to get more detailed debug logs.", "default": "INFO", "anyOf": [ { "type": "integer" }, { "type": "string" } ] }, "logs_dir": { "title": "Logs Dir", "description": "Directory to store the logs. Default to None, which means logs will be stored in the default directory ('/tmp/ray/session_latest/logs/serve/...').", "type": "string" }, "enable_access_log": { "title": "Enable Access Log", "description": "Whether to enable access logs for each request. Default to True.", "default": true, "type": "boolean" } }, "additionalProperties": false, "definitions": { "EncodingType": { "title": "EncodingType", "description": "Encoding type for the serve logs.\n\n**PublicAPI (alpha):** This API is in alpha and may change before becoming stable.", "enum": [ "TEXT", "JSON" ], "type": "string" } } }
- Config:
extra: Extra = Extra.forbid
- Fields:
- Validators:
- 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.- Validated by:
- 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.
- Validated by: