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

Is there a way to disable sync logs? #39

Open
juliuslipp opened this issue Mar 1, 2024 · 5 comments
Open

Is there a way to disable sync logs? #39

juliuslipp opened this issue Mar 1, 2024 · 5 comments
Labels
bug Something isn't working embedded replicas
Milestone

Comments

@juliuslipp
Copy link

Currently, every time the embedded replica is called it emits some logs:

2024-03-01T12:59:25.195724Z  INFO libsql_replication::replicator: Attempting to perform handshake with primary.
2024-03-01T12:59:25.195778Z  INFO libsql::replication::remote_client: Attempting to perform handshake with primary.
2024-03-01T12:59:25.238512Z  INFO libsql_replication::replicator: Attempting to perform handshake with primary.

Is there a way to disable this?

@grumpyp
Copy link

grumpyp commented Mar 9, 2024

did you try

import logging
replication_logger = logging.getLogger("libsql_replication")
remote_client_logger = logging.getLogger("libsql.replication.remote_client")
# set the logger for liqsql_replication and remote client to WARNING only
replication_logger.setLevel(logging.WARNING)
remote_client_logger.setLevel(logging.WARNING)

Or you could try
logging.getLogger().setLevel(logging.WARNING)
which sets all loggers to WARNING only

@juliuslipp juliuslipp reopened this Mar 9, 2024
@penberg
Copy link
Contributor

penberg commented Mar 10, 2024

This should be fixed by #40 once it is merged

@penberg penberg added bug Something isn't working embedded replicas labels Mar 10, 2024
@penberg penberg added this to the 0.1 milestone Mar 10, 2024
@isaccavalcante
Copy link

@penberg apparently #40 did not fix it

@hbmartin
Copy link

hbmartin commented Jul 9, 2024

Same, I'm on the latest release and tried the config block from @grumpyp but still seeing the logs

Aside, I have a small (<5MB) database with no writes since last sync but calling sync still takes just under a minute, is this expected?

@FyZyX
Copy link

FyZyX commented Jul 14, 2024

Just playing around with this library for the first time today and ran into this. I'm working on a CLI tool and these logs are very distracting. Best solution I found for now is to set the RUST_LOG environment variable to something above info.

export RUST_LOG=error

Python logging configuration won't help here because the logs are coming from the libsql Rust code. You can see the source of the logs here.

Not sure what the optimal solution would be for this library, but I'd probably look for a way to pass the Python log level down to the Rust logging configuration.

Regardless, setting the log level manually should be a sufficient workaround for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working embedded replicas
Projects
None yet
Development

No branches or pull requests

6 participants