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

how can close pulsar logs #393

Open
frkn4129 opened this issue Feb 1, 2024 · 1 comment
Open

how can close pulsar logs #393

frkn4129 opened this issue Feb 1, 2024 · 1 comment

Comments

@frkn4129
Copy link

frkn4129 commented Feb 1, 2024

I am using Pulsar Cpp in my project but it produces pulsar INFO logs roughly every 10 minutes. How can I close INFO logs from Pulsar?
Example Log:

INFO [139790546368256] ProducerStatsImpl:87 | Producer [persistent://public/default/test_fm_2, ] , ProducerStatsImpl (numMsgsSent_ = 1151, numBytesSent_ = 99461243, sendMap_ = {[Key: Ok, Value: 1151], }, latencyAccumulator_ = Latencies [ 50pct: 2.70125ms, 90pct: 91.4338ms, 99pct: 353.278ms, 99.9pct: 540.775ms], totalMsgsSent_ = 1151, totalBytesSent_ = 99461243, totalAcksReceived_ = , totalSendMap_ = {[Key: Ok, Value: 1151], }, totalLatencyAccumulator_ = Latencies [ 50pct: 2.70125ms, 90pct: 91.4338ms, 99pct: 353.278ms, 99.9pct: 540.775ms])

@BewareMyPower
Copy link
Contributor

First, these logs come from the stats timer. You can disable the stats by configuring the stats interval with 0.

ClientConfiguration& setStatsIntervalInSeconds(const unsigned int&);

Second, if you really want to disable the INFO logs rather than the stats timer. You can configure a customized logger.

ClientConfiguration& setLogger(LoggerFactory* loggerFactory);

There are two built-in loggers:

For simplicity, if you still want to print logs to console and just change the log level to warn, here is an example.

    ClientConfiguration conf;
    conf.setLogger(new ConsoleLoggerFactory(Logger::LEVEL_WARN));
    Client client("pulsar://localhost:6650", conf);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants