Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some docs about logging in standalone apps #2209

Merged
merged 1 commit into from
Oct 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions docs/client-standalone.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,24 @@ it's probably because the client is maintaining a `Vertx` instance that it creat
issue, you might need to create a `Vertx` instance on your own, pass it to the client builder, and then close it after
closing the client. See the following JBang snippet for an example.

## Logging with a standalone (Java SE) application using the SmallRye GraphQL Client

If you want to properly configure logging in a standalone application, you
will also need to add a logging implementation to the classpath. The client
code uses the JBoss Logging facade, so you can, for example, use the JBoss
Logmanager. Add the `org.jboss.logmanager:jboss-logmanager` dependency to
your project(it needs to be on the runtime classpath). You will also need to
run the application with this system property declared:
`-Djava.util.logging.manager=org.jboss.logmanager.LogManager`.

To customize logging levels etc, it picks up the `logging.properties` file
from the root of the runtime classpath, so, for example if using Maven and
the exec plugin to start the application, you would place the file into
`src/main/resources/logging.properties`. For an example of the contents of
this file, see
https://github.com/jamezp/jboss-logging-example/blob/master/src/main/resources/logging.properties.


## Using with JBang

This is a full script runnable directly with [JBang](https://www.jbang.dev/) that
Expand Down Expand Up @@ -55,3 +73,5 @@ class Client {
```

Save this file as `Client.java` and execute with `jbang Client.java`.


Loading