{"id":15221987,"url":"https://github.com/googlecloudplatform/pgadapter","last_synced_at":"2026-01-06T08:14:23.366Z","repository":{"id":36973508,"uuid":"395802914","full_name":"GoogleCloudPlatform/pgadapter","owner":"GoogleCloudPlatform","description":"PostgreSQL wire-protocol proxy for Cloud Spanner","archived":false,"fork":false,"pushed_at":"2025-03-30T15:03:59.000Z","size":49735,"stargazers_count":67,"open_issues_count":51,"forks_count":28,"subscribers_count":26,"default_branch":"postgresql-dialect","last_synced_at":"2025-03-30T15:43:24.898Z","etag":null,"topics":["cloud","google","google-cloud","google-cloud-spanner","postgresql","spanner","sql"],"latest_commit_sha":null,"homepage":"https://cloud.google.com/spanner/docs/postgresql-interface#postgresql-client-support","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GoogleCloudPlatform.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-13T21:34:00.000Z","updated_at":"2025-03-30T15:04:01.000Z","dependencies_parsed_at":"2023-10-15T12:44:26.555Z","dependency_job_id":"3a9abb88-4b47-4f4f-b2cf-99f73f7218d5","html_url":"https://github.com/GoogleCloudPlatform/pgadapter","commit_stats":{"total_commits":2048,"total_committers":13,"mean_commits":"157.53846153846155","dds":0.61962890625,"last_synced_commit":"3dbb8e6dcf959b0e092b085c72804b6c452e677a"},"previous_names":[],"tags_count":65,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleCloudPlatform%2Fpgadapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleCloudPlatform%2Fpgadapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleCloudPlatform%2Fpgadapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleCloudPlatform%2Fpgadapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GoogleCloudPlatform","download_url":"https://codeload.github.com/GoogleCloudPlatform/pgadapter/tar.gz/refs/heads/postgresql-dialect","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247526761,"owners_count":20953143,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloud","google","google-cloud","google-cloud-spanner","postgresql","spanner","sql"],"created_at":"2024-09-28T15:09:34.431Z","updated_at":"2026-01-06T08:14:23.340Z","avatar_url":"https://github.com/GoogleCloudPlatform.png","language":"Java","readme":"# Google Cloud Spanner PGAdapter\n\nPGAdapter is a proxy that translates the PostgreSQL wire-protocol into the\nequivalent for Spanner databases [that use the PostgreSQL interface](https://cloud.google.com/spanner/docs/postgresql-interface).\nIt enables you to use standard PostgreSQL drivers and tools with Cloud Spanner and is designed for\nthe [lowest possible latency](benchmarks/latency-comparison/README.md).\n\n__Note__: JVM-based applications can add PGAdapter as a compile-time dependency and run the proxy\nin the same process as the main application. See [samples/java/jdbc](samples/java/jdbc) for a\nsmall sample application that shows how to do this.\n\n## Drivers and Clients\nPGAdapter can be used with the following drivers and clients:\n1. `psql`: Versions 11, 12, 13 and 14 are supported. See [psql support](docs/psql.md) for more details.\n1. `IntelliJ`, `DataGrip` and other `JetBrains` IDEs. See [Connect Cloud Spanner PostgreSQL to JetBrains](docs/intellij.md) for more details.\n1. `JDBC`: Versions 42.x and higher are supported. See [JDBC support](docs/jdbc.md) for more details.\n1. `R2DBC`: Versions 1.0.7 and higher are supported. See [R2DBC sample](samples/java/r2dbc) for a small sample application.\n1. `pgx`: Version 4.15 and higher are supported. See [pgx support](docs/pgx.md) for more details.\n1. `psycopg2`: Version 2.9.3 and higher are supported. See [psycopg2](docs/psycopg2.md) for more details.\n1. `psycopg3`: Version 3.1.x and higher are supported. See [psycopg3 support](docs/psycopg3.md) for more details.\n1. `connectorx`: Version 0.3.3 and higher have experimental support. See [connectorx sample](samples/python/connectorx) for more details.\n1. `node-postgres`: Version 8.8.0 and higher are supported. See [node-postgres support](docs/node-postgres.md) for more details.\n1. `npgsql`: Version 6.0.x and higher have experimental support. See [npgsql support](docs/npgsql.md) for more details.\n1. `PDO_PGSQL`: The PHP PDO driver has experimental support. See [PHP PDO](docs/pdo.md) for more details.\n1. `postgres_fdw`: The PostgreSQL foreign data wrapper has experimental support. See [Foreign Data Wrapper sample](samples/foreign-data-wrapper) for more details.\n\n## ORMs, Frameworks and Tools\nPGAdapter can be used with the following frameworks and tools:\n1. `Hibernate`: Version 5.3.20.Final and higher are supported. See [hibernate support](samples/java/hibernate/README.md) for more details.\n1. `Spring Data JPA`: Spring Data JPA in combination with Hibernate is also supported. See the [Spring Data JPA Sample Application](samples/java/spring-data-jpa) for a full example.\n1. `Liquibase`: Version 4.12.0 and higher are supported. See [Liquibase support](docs/liquibase.md)\n   for more details. See also [this directory](samples/java/liquibase) for a sample application using `Liquibase`.\n1. `gorm`: Version 1.23.8 and higher are supported. See [gorm support](docs/gorm.md) for more details.\n   See also [this directory](samples/golang/gorm) for a sample application using `gorm`.\n1. `SQLAlchemy 2.x`: Version 2.0.1 and higher are supported.\n   See also [this directory](samples/python/sqlalchemy2-sample) for a sample application using `SQLAlchemy 2.x`.\n1. `SQLAlchemy 1.x`: Version 1.4.45 and higher has _experimental support_. It is recommended to use `SQLAlchemy 2.x`\n   instead of `SQLAlchemy 1.4.x` for the [best possible performance](docs/sqlalchemy.md#limitations). \n   See also [this directory](samples/python/sqlalchemy-sample) for a sample application using `SQLAlchemy 1.x`.\n1. `pgbench` can be used with PGAdapter, but with some limitations. See [pgbench.md](docs/pgbench.md)\n   for more details.\n1. `Ruby ActiveRecord`: Version 7.x has _experimental support_ and with limitations. Please read the\n   instructions in [PGAdapter - Ruby ActiveRecord Connection Options](docs/ruby-activerecord.md)\n   carefully for how to set up ActiveRecord to work with PGAdapter.\n1. `Knex.js` query builder can be used with PGAdapter. See [Knex.js sample application](samples/nodejs/knex)\n   for a sample application.\n1. `Sequelize.js` ORM can be used with PGAdapter. See [Sequelize.js sample application](samples/nodejs/sequelize)\n   for a sample application.\n1. `Prisma` ORM can be used with PGAdapter. See [Prisma sample application](samples/nodejs/prisma-sample-app)\n   for a sample application.\n\n## FAQ\nSee [Frequently Asked Questions](docs/faq.md) for answers to frequently asked questions.\n\n## Performance\nSee [Latency Comparisons](benchmarks/latency-comparison/README.md) for benchmark comparisons between\nusing PostgreSQL drivers with PGAdapter and using native Cloud Spanner drivers and client libraries.\n\n## Insights\nSee [OpenTelemetry in PGAdapter](docs/open_telemetry.md) for how to use `OpenTelemetry` to collect\nand export traces to Google Cloud Trace.\n\n## Usage\nPGAdapter can be started both as a Docker container, a standalone process as well as an\nin-process server (the latter is only supported for Java and other JVM-based applications).\n\n### Docker\n\n* See [running PGAdapter using Docker](docs/docker.md) for more examples for running PGAdapter in Docker.\n* See [running PGAdapter as a sidecar proxy](docs/sidecar-proxy.md) for how to run PGAdapter as a\n  sidecar proxy in a Kubernetes cluster.\n\nReplace the project, instance and database names and the credentials file in the example below to\nrun PGAdapter from a pre-built Docker image.\n\n```shell\ndocker pull gcr.io/cloud-spanner-pg-adapter/pgadapter\ndocker run \\\n  -d -p 5432:5432 \\\n  -v /path/to/credentials.json:/credentials.json:ro \\\n  gcr.io/cloud-spanner-pg-adapter/pgadapter \\\n  -p my-project -i my-instance -d my-database \\\n  -c /credentials.json -x\n```\n\nThe `-x` argument turns off the requirement that all TCP connections must come from localhost.\nThis is required when running PGAdapter in a Docker container.\n\nSee [Options](#Options) for an explanation of all further options.\n\n#### Distroless Docker Image\n\nWe also publish a [distroless Docker image](https://github.com/GoogleContainerTools/distroless) for\nPGAdapter under the tag `gcr.io/cloud-spanner-pg-adapter/pgadapter-distroless`. This Docker image\nruns PGAdapter as a non-root user.\n\n```shell\ndocker pull gcr.io/cloud-spanner-pg-adapter/pgadapter-distroless\ndocker run \\\n  -d -p 5432:5432 \\\n  -v /path/to/credentials.json:/credentials.json:ro \\\n  gcr.io/cloud-spanner-pg-adapter/pgadapter-distroless \\\n  -p my-project -i my-instance -d my-database \\\n  -c /credentials.json -x\n```\n\n### Standalone with pre-built jar\n\nA pre-built jar and all dependencies can be downloaded from https://storage.googleapis.com/pgadapter-jar-releases/pgadapter.tar.gz\n\n```shell\nwget https://storage.googleapis.com/pgadapter-jar-releases/pgadapter.tar.gz \\\n  \u0026\u0026 tar -xzvf pgadapter.tar.gz\njava -jar pgadapter.jar -p my-project -i my-instance -d my-database\n```\n\nUse the `-s` option to specify a different local port than the default 5432 if you already have\nPostgreSQL running on your local system.\n\n\u003c!--- {x-version-update-start:google-cloud-spanner-pgadapter:released} --\u003e\nYou can also download a specific version of the jar. Example (replace `v0.53.0` with the version you want to download):\n```shell\nVERSION=v0.53.0\nwget https://storage.googleapis.com/pgadapter-jar-releases/pgadapter-${VERSION}.tar.gz \\\n  \u0026\u0026 tar -xzvf pgadapter-${VERSION}.tar.gz\njava -jar pgadapter.jar -p my-project -i my-instance -d my-database\n```\n\u003c!--- {x-version-update-end} --\u003e\n\nSee [Options](#Options) for an explanation of all further options.\n\n### Standalone with locally built jar\n1. Build a jar file and assemble all dependencies by running\n\n```shell\nmvn package -P assembly\n```\n\n2. Execute (the binaries are in the target/pgadapter folder)\n```shell\ncd target/pgadapter\njava -jar pgadapter.jar -p my-project -i my-instance -d my-database\n```\n\nSee [Options](#Options) for an explanation of all further options.\n\n### In-process\nThis option is only available for Java/JVM-based applications.\n\n1. Add `google-cloud-spanner-pgadapter` as a dependency to your project by adding this to your `pom.xml` file:\n\n\u003c!--- {x-version-update-start:google-cloud-spanner-pgadapter:released} --\u003e\n```xml\n\u003c!-- [START pgadapter_dependency] --\u003e\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.google.cloud\u003c/groupId\u003e\n  \u003cartifactId\u003egoogle-cloud-spanner-pgadapter\u003c/artifactId\u003e\n  \u003cversion\u003e0.53.0\u003c/version\u003e\n\u003c/dependency\u003e\n\u003c!-- [END pgadapter_dependency] --\u003e\n```\n\u003c!--- {x-version-update-end} --\u003e\n\n\n2. Build a server using the `com.google.cloud.spanner.pgadapter.ProxyServer` class:\n\n```java\nclass PGProxyRunner {\n  public static void main(String[] args) {\n      OptionsMetadata.Builder builder =\n          OptionsMetadata.newBuilder()\n              .setProject(\"my-project\")\n              .setInstance(\"my-instance\")\n              .setDatabase(\"my-database\")\n              .setCredentialsFile(\"/path/to/credentials.json\")\n              // Start PGAdapter on any available port.\n              .setPort(0);\n      ProxyServer server = new ProxyServer(builder.build());\n      server.startServer();\n      server.awaitRunning();\n    }\n}\n```\n\nSee [samples/java/jdbc](samples/java/jdbc) for a small sample application that adds\nPGAdapter as a compile-time dependency and runs it together with the main application.\n\n## Emulator\nA pre-built Docker image that contains both PGAdapter and the Spanner Emulator can be started with\nthese commands:\n\n```shell\ndocker pull gcr.io/cloud-spanner-pg-adapter/pgadapter-emulator\ndocker run \\\n  -d -p 5432:5432 \\\n  gcr.io/cloud-spanner-pg-adapter/pgadapter-emulator\nsleep 2\npsql -h localhost -p 5432 -d test-database\n```\n\nThis Docker container configures PGAdapter to connect to a Cloud Spanner Emulator running inside\nthe same container. You do not need to first create a Spanner instance or database on the Emulator\nbefore connecting to them. Instead, the instance and database are automatically created on the\nEmulator when you connect to PGAdapter.\n\n### Additional Information\nSee [this document](docs/emulator.md) for more information on how to connect PGAdapter to the Cloud\nSpanner Emulator.\n\nConnecting to the Cloud Spanner Emulator is supported with:\n1. PGAdapter version 0.26.0 and higher.\n2. Cloud Spanner Emulator 1.5.12 and higher.\n\n### Options\n\nThe following list contains the most frequently used startup options for PGAdapter.\n\n```\n-p \u003cprojectname\u003e\n  * The project name where the Spanner database(s) is/are running. If omitted, all connection\n    requests must use a fully qualified database name in the format\n    'projects/my-project/instances/my-instance/databases/my-database'.\n    \n-i \u003cinstanceid\u003e\n  * The instance ID where the Spanner database(s) is/are running. If omitted, all connection\n    requests must use a fully qualified database name in the format\n    'projects/my-project/instances/my-instance/databases/my-database'.\n\n-d \u003cdatabasename\u003e\n  * The default Spanner database name to connect to. This is only required if you want PGAdapter to\n    ignore the database that is given in the connection request from the client and to always\n    connect to this database.\n  * If set, any database given in a connection request will be ignored. \\c commands in psql will not\n    change the underlying database that PGAdapter is connected to.\n  * If not set, the database to connect to must be included in any connection request. \\c commands\n    in psql will change the underlying database that PGAdapter connects to.\n\n-c \u003ccredentialspath\u003e\n  * This argument should not be used in combination with -a (authentication mode).\n  * This is only required if you have not already set up default credentials on the system where you\n    are running PGAdapter. See https://cloud.google.com/spanner/docs/getting-started/set-up#set_up_authentication_and_authorization\n    for more information on setting up authentication for Cloud Spanner.\n  * The full path for the file containing the service account credentials in JSON format.\n  * Do remember to grant the service account sufficient credentials to access the database. See\n    https://cloud.google.com/docs/authentication/production for more information.\n\n-s \u003cport\u003e\n  * The inbound port for the proxy. Defaults to 5432. Choose a different port if you already have\n    PostgreSQL running on your local system.\n\n-dir \u003csocket-file-directory\u003e\n  * This proxy's domain socket directory. Defaults to '/tmp'.\n    Note: Some distributions of PostgreSQL and psql use '/var/run/postgresql' as the\n    default directory for Unix domain socket file names. When connecting to PGAdapter\n    using psql from one of these distributions, you either need to use 'psql -h /tmp'\n    or change the default Unix domain socket directory used by PGAdapter to '/var/run/postgresql'.\n\n-ddl \u003cddl-transaction-mode\u003e\n  * Determines the behavior of the proxy when DDL statements are executed in transactions.\n    See DDL options for more information.\n\n-cmd \u003ccommand\u003e\n  * Run this command or tool and connect it to PGAdapter. This can be used to quickly start a PostgreSQL\n    tool along with PGAdapter, and connect to Spanner. The following command will for example start\n    PGAdapter and psql, and automatically connect psql to PGAdapter:\n    java -jar pgadapter.jar -p my-project -i my-instance -d my-database -cmd psql\n\n-a\n  * Turns on authentication for the proxy server. Clients are then requested\n    to supply a username and password during a connection request.\n  * The username and password must contain one of the following:\n    1. The password field must contain the JSON payload of a credentials file, for example from a service account key file. The username will be ignored in this case.\n    2. The password field must contain the private key from a service account key file. The username must contain the email address of the corresponding service account.\n  * Note that SSL is not supported for the connection between the client and\n    PGAdapter. The proxy should therefore only be used within a private network.\n    The connection between PGAdapter and Cloud Spanner is always secured with SSL.\n\n-x\n  * PGAdapter by default only allows TCP connections from localhost or Unix Domain Socket connections.\n    Use the -x switch to turn off the localhost check. This is required when running PGAdapter in a\n    Docker container, as the connections from the host machine will not be seen as a connection from\n    localhost in the container.\n\n--allow_shutdown_statement\n  * Enables the use of the custom SQL command `SHUTDOWN [SMART | FAST | IMMEDIATE]`. This command can\n    be used to shut down PGAdapter by just sending it a SQL statement. This option should only be enabled\n    when PGAdapter runs in a trusted environment, for example as a side-car container. The default\n    shutdown mode is `FAST`, which terminates all existing connections and then shuts down PGAdapter.\n    Use shutdown mode `SMART` to instruct PGAdapter to wait until all existing connections have been\n    terminated by the client before shutting down. See also https://www.postgresql.org/docs/current/server-shutdown.html\n    for more information about shutdown modes.\n  * Note that `SHUTDOWN [SMART | FAST | IMMEDIATE]` only works on PGAdapter. This command is not\n    supported by PostgreSQL.\n```\n\n* See [command line arguments](docs/command_line_arguments.md) for a list of all supported arguments.\n* See [connection options](docs/connection_options.md) for all connection options.\n* See [Authentication Options](docs/authentication.md) for more details on the `-a` command line\n  argument and other authentication options.\n* See [DDL Options](docs/ddl.md) for more details for the `-ddl` command line argument.\n\n#### Example - Connect to a Single Database\n\nThis example starts PGAdapter and instructs it to always connect to the same database using a fixed\nset of credentials:\n\n```shell\njava -jar pgadapter.jar \\\n     -p \u003cproject-id\u003e -i \u003cinstance-id\u003e -d \u003cdatabase-id\u003e \\\n     -c \u003cpath to credentials file\u003e -s 5432\npsql -h localhost\n```\n\nThe psql `-d` command line argument will be ignored. The psql `\\c` meta-command will have no effect.\n\n#### Example - Start PGAdapter and psql together\n\nThis example starts PGAdapter and psql together and automatically connects psql to PGAdapter:\n\n```shell\njava -jar pgadapter.jar \\\n     -p \u003cproject-id\u003e -i \u003cinstance-id\u003e -d \u003cdatabase-id\u003e \\\n     -cmd psql\n```\n\n#### Example - Require Authentication and Fully Qualified Database Name\n\nThis example starts PGAdapter and requires the client to supply both credentials and a fully\nqualified database name. This allows a single instance of PGAdapter to serve connections to any\nCloud Spanner database.\n\n```shell\njava -jar pgadapter.jar -a\n\n# The credentials file must be a valid Google Cloud credentials file, such as a\n# service account key file or a user credentials file.\n# Note that you must enclose the database name in quotes as it contains slashes.\nPGPASSWORD=$(cat /path/to/credentials.json) psql -h /tmp \\\n  -d \"projects/my-project/instances/my-instance/databases/my-database\"\n```\n\nThe psql `\\c` meta-command can be used to switch to a different database.\n\n## Details\nGoogle Cloud Spanner PGAdapter is a simple, MITM, forward, non-transparent proxy, which translates\nthe PostgreSQL wire-protocol into the Cloud Spanner equivalent. It can only be used with Cloud\nSpanner databases that use the [PostgreSQL interface](https://cloud.google.com/spanner/docs/postgresql-interface).\nBy running this proxy locally, any PostgreSQL client (including the SQL command-line client PSQL)\nshould function seamlessly by simply pointing its outbound port to this proxy's inbound port.\nThe proxy does not support all parts of the PostgreSQL wire-protocol. See [Limitations](#Limitations)\nfor a list of current limitations.\n\nIn addition to translation, this proxy also concerns itself with authentication\nand to some extent, connection pooling. Translation for the most part is simply\na transformation of the [PostgreSQL wire protocol](https://www.postgresql.org/docs/current/protocol-message-formats.html)\nexcept for some cases concerning PSQL, wherein the query itself is translated.\n\nSimple query mode and extended query mode are supported, and any data type\nsupported by Spanner is also supported. Cloud Spanner databases created with\nPostgreSQL dialect do not support all `pg_catalog` tables.\n\nThough the majority of functionality inherent in most PostgreSQL clients are included\nout of the box, the following items are not supported:\n* SSL\n* COPY \u003ctable_name\u003e FROM \u003cfilename | PROGRAM program\u003e\n\nSee [COPY \u003ctable-name\u003e FROM STDIN](docs/copy.md) for more information on the COPY operations that\nare supported.\n\nOnly the following `psql` meta-commands are supported:\n  * `\\d \u003ctable\u003e` \n  * `\\dt \u003ctable\u003e`\n  * `\\dn \u003ctable\u003e`\n  * `\\di \u003ctable\u003e`\n  * `\\l`\n\nOther `psql` meta-commands are __not__ supported.\n\n## Limitations\n\nPGAdapter has the following known limitations at this moment:\n- Only [password authentication](https://www.postgresql.org/docs/current/auth-password.html) using\n  the `password` method is supported. All other authentication methods are not supported.\n- The COPY protocol only supports COPY TO|FROM STDOUT|STDIN [BINARY]. COPY TO|FROM \u003cFILE|PROGRAM\u003e is not supported.\n  See [COPY](docs/copy.md) for more information.\n- DDL transactions are not supported. PGAdapter allows DDL statements in implicit transactions,\n  and executes SQL strings that contain multiple DDL statements as a single DDL batch on Cloud\n  Spanner. See [DDL transaction options](docs/ddl.md) for more information.\n\n## Logging\n\nPGAdapter uses `java.util.logging` for logging.\n\n### Default Logging\n\nPGAdapter by default configures `java.util.logging` to do the following:\n1. Log messages of level WARNING and higher are logged to `stderr`.\n2. Log messages of level INFO are logged to `stdout`.\n3. Log messages of higher levels than INFO are not logged.\n\nYou can supply your own logging configuration with the `-Djava.util.logging.config.file`\nSystem property. See the next section for an example.\n\nThe default log configuration described in this section was introduced in version 0.33.0 of\nPGAdapter. Prior to that, PGAdapter used the default `java.util.logging` configuration, which\nlogs everything to `stderr`.\n\nYou can disable the default PGAdapter log configuration and go back to the standard\n`java.util.logging` configuration by starting PGAdapter with the command line argument\n`-legacy_logging`.\n\n### Custom Logging Configuration\n\nCreate a `logging.properties` file to configure logging messages.\nSee the following example for an example to get fine-grained logging.\n\n```\nhandlers=java.util.logging.ConsoleHandler,java.util.logging.FileHandler\ncom.google.cloud.spanner.pgadapter.level=FINEST\njava.util.logging.ConsoleHandler.level=FINEST\njava.util.logging.FileHandler.level=INFO\njava.util.logging.FileHandler.pattern=%h/log/pgadapter-%u.log\njava.util.logging.FileHandler.append=false\nio.grpc.internal.level = WARNING\n\njava.util.logging.SimpleFormatter.format=[%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS.%1$tL] [%4$s] (%2$s): %5$s%6$s%n\njava.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter\n```\n\nStart PGAdapter with `-Djava.util.logging.config.file=logging.properties` when running PGAdapter\nas a jar.\n\n### Logging in Docker\n\nYou can configure PGAdapter to log to a file on your local system when running it in Docker by\nfollowing these steps.\n\n1. Create a `logging.properties` on your local system like this:\n\n```\nhandlers=java.util.logging.FileHandler\njava.util.logging.FileHandler.level=INFO\njava.util.logging.FileHandler.pattern=/home/pgadapter/log/pgadapter.log\njava.util.logging.FileHandler.append=true\nio.grpc.internal.level = WARNING\n\njava.util.logging.SimpleFormatter.format=[%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS.%1$tL] [%4$s] (%2$s): %5$s%6$s%n\njava.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter\n```\n\n2. Start the PGAdapter Docker container with these options:\n\n```shell\nexport GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials.json\nexport LOGGING_PROPERTIES=/full/path/to/logging.properties\ndocker run \\\n    -d -p 5432:5432 \\\n    -v ${GOOGLE_APPLICATION_CREDENTIALS}:${GOOGLE_APPLICATION_CREDENTIALS}:ro \\\n    -v ${LOGGING_PROPERTIES}:${LOGGING_PROPERTIES}:ro \\\n    -v /home/my-user-name/log:/home/pgadapter/log \\\n    -e GOOGLE_APPLICATION_CREDENTIALS \\\n    gcr.io/cloud-spanner-pg-adapter/pgadapter \\\n    -Djava.util.logging.config.file=${LOGGING_PROPERTIES} \\\n    -p my-project -i my-instance -d my-database \\\n    -x\n```\n\nThe directory `/home/my-user-name/log` will be created automatically and the log file will be\nplaced in this directory.\n\n## Support Level\n\nWe are not currently accepting external code contributions to this project. \nPlease feel free to file feature requests using GitHub's issue tracker or \nusing the existing Cloud Spanner support channels.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgooglecloudplatform%2Fpgadapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgooglecloudplatform%2Fpgadapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgooglecloudplatform%2Fpgadapter/lists"}