| 1 | |
package com.ctrip.framework.apollo.biz.customize; |
| 2 | |
|
| 3 | |
import com.ctrip.framework.apollo.biz.service.ServerConfigService; |
| 4 | |
import com.ctrip.framework.apollo.common.customize.LoggingCustomizer; |
| 5 | |
|
| 6 | |
import org.springframework.beans.factory.annotation.Autowired; |
| 7 | |
import org.springframework.context.annotation.Profile; |
| 8 | |
import org.springframework.stereotype.Component; |
| 9 | |
|
| 10 | |
@Component |
| 11 | |
@Profile("ctrip") |
| 12 | 0 | public class BizLoggingCustomizer extends LoggingCustomizer{ |
| 13 | |
|
| 14 | |
private static final String CLOGGING_SERVER_URL_KEY = "clogging.server.url"; |
| 15 | |
private static final String CLOGGING_SERVER_PORT_KEY = "clogging.server.port"; |
| 16 | |
|
| 17 | |
@Autowired |
| 18 | |
private ServerConfigService serverConfigService; |
| 19 | |
|
| 20 | |
private String cloggingUrl; |
| 21 | |
private String cloggingPort; |
| 22 | |
|
| 23 | |
@Override |
| 24 | |
protected String cloggingUrl() { |
| 25 | 0 | if (cloggingUrl == null){ |
| 26 | 0 | cloggingUrl = serverConfigService.getValue(CLOGGING_SERVER_URL_KEY); |
| 27 | |
} |
| 28 | 0 | return cloggingUrl; |
| 29 | |
} |
| 30 | |
|
| 31 | |
@Override |
| 32 | |
protected String cloggingPort() { |
| 33 | 0 | if (cloggingPort == null){ |
| 34 | 0 | cloggingPort = serverConfigService.getValue(CLOGGING_SERVER_PORT_KEY); |
| 35 | |
} |
| 36 | 0 | return cloggingPort; |
| 37 | |
} |
| 38 | |
} |