---
name: "mongoc_structured_log_opts_set_max_document_length_from_env"
section: "3"
platform: "linux"
package: "libmongoc-doc"
version: "1.30.4-1+deb13u3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/mongoc_structured_log_opts_set_max_document_length_from_env"
---

# mongoc\_structured\_log\_opts\_set\_max\_document\_length\_from\_env(3)

## SYNOPSIS

```
bool
mongoc_structured_log_opts_set_max_document_length_from_env (mongoc_structured_log_opts_t *opts);
```

Sets a maximum document length from the **MONGODB\_LOG\_MAX\_DOCUMENT\_LENGTH** environment variable, if a valid setting is found. See *mongoc\_structured\_log\_opts\_new()* for a description of the supported environment variable formats.

Parse errors may cause a warning message, delivered via unstructured logging.

This happens automatically when *mongoc\_structured\_log\_opts\_new()* establishes defaults. Any subsequent programmatic modifications to the *mongoc\_structured\_log\_opts\_t* will override the environment variable settings. For applications that desire the opposite behavior, where environment variables may override programmatic settings, they may call **mongoc\_structured\_log\_opts\_set\_max\_document\_length\_from\_env()** after calling *mongoc\_structured\_log\_opts\_set\_max\_document\_length()*. This will process the environment a second time, allowing it to override customized defaults.

## RETURNS

Returns **true** on success: either a valid environment setting was found, or the value is unset and **opts** will not be modified. If warnings are encountered in the environment, returns **false** and may log additional information to the unstructured logging facility. Note that, by design, these errors are by default non-fatal. When *mongoc\_structured\_log\_opts\_new()* internally calls this function, it ignores the return value.

**SEE ALSO:**

```
Structured Logging
```

## AUTHOR

MongoDB, Inc

## COPYRIGHT

2009-present, MongoDB, Inc.
