How to redirect the logger to file?
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?
@edenhill
log_cb config??
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.
+1 for logger framework
+1 for log_cb implementation
dup of #148