Skip to content

Commit 294411f

Browse files
authored
chore (doc): update readme partial template (#675)
add information about synchronicity flag
1 parent 8a93aaa commit 294411f

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

‎.readme-partials.yaml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,28 @@ custom_content: |
6666
.build();
6767
logging.write(Collections.singleton(firstEntry));
6868
```
69-
69+
70+
The library supports writing log entries synchronously and asynchronously.
71+
In the synchronous mode each call to `write()` method results in a consequent call to Logging API to write a log entry.
72+
In the asynchronous mode the call(s) to Logging API takes place asynchronously and few calls to `write()` method may be batched together to compose a single call to Logging API.
73+
The default mode of writing is asynchronous.
74+
It can be configured in the `java.util.logging` handler [configuration file](https://cloud.google.com/logging/docs/setup/java#javautillogging_configuration):
75+
76+
```
77+
com.google.cloud.logging.LoggingHandler.synchronicity=SYNC
78+
```
79+
80+
or in the code after initiating an instance of `Logging` by calling:
81+
82+
```java
83+
logging.setWriteSynchronicity(Synchronicity.SYNC);
84+
```
85+
86+
NOTE:
87+
> Writing log entries asynchronously in some Google Cloud managed environments (e.g. Cloud Functions)
88+
> may lead to unexpected results such as absense of expected log entries or abnormal program execution.
89+
> To avoid these unexpected results, it is recommended to use synchronous mode.
90+
7091
#### Listing log entries
7192
7293
With Logging you can also list log entries that have been previously written. Add the following

0 commit comments

Comments
 (0)