Skip to content

How to redirect the logger to file? #168

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

Closed
zjyExcelsior opened this issue Apr 5, 2017 · 6 comments
Closed

How to redirect the logger to file? #168

zjyExcelsior opened this issue Apr 5, 2017 · 6 comments

Comments

@zjyExcelsior
Copy link

zjyExcelsior commented Apr 5, 2017

When I initiated a producer using codes like this:

KAFKA_BROKERS = '192.168.7.12:9092,192.168.7.13:9093,192.168.7.14.9094'
KAFKA_TOPIC = 'only_test'
KAFKA_PRODUCER_CONF = {
    'api.version.request': False,  # default, not need to set (yet)
    'broker.version.fallback': '0.8.2.2',
    'bootstrap.servers': KAFKA_BROKERS,
    'client.id': 'message_service',
    'default.topic.config': {'acks': 'all'}
}
producer = Producer(**KAFKA_PRODUCER_CONF)

on the console, I often see some logs like this:

%3|1491402980.949|FAIL|message_service#producer-1| [thrd:192.168.7.14:9094/bootstrap]: 192.168.7.14:9094/bootstrap: Connect to ipv4#192.168.7.14:9094 failed: Connection refused
%3|1491402980.949|ERROR|message_service#producer-1| [thrd:192.168.7.14:9094/bootstrap]: 192.168.7.14:9094/bootstrap: Connect to ipv4#192.168.7.14:9094 failed: Connection refused

I want to know, how can I add my specific logger like FileHandler to redirect these logs to files?

@zjyExcelsior
Copy link
Author

@edenhill

@zjyExcelsior
Copy link
Author

log_cb config??

@edenhill
Copy link
Contributor

edenhill commented May 2, 2017

Sorry for the delay.

There is currently no support for setting a log callback, logs will be printed on stderr.

We are planning to provide either log callbacks, or plugging into the logger framework.

@jackandrews
Copy link

+1 for logger framework

@vavroch2010
Copy link

+1 for log_cb implementation

@edenhill
Copy link
Contributor

edenhill commented Aug 9, 2017

dup of #148

@edenhill edenhill closed this as completed Aug 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants