Java Code Examples for com.alibaba.csp.sentinel.log.RecordLog#info()
The following examples show how to use
com.alibaba.csp.sentinel.log.RecordLog#info() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UpdateGatewayRuleCommandHandler.java From Sentinel with Apache License 2.0 | 6 votes |
@Override public CommandResponse<String> handle(CommandRequest request) { String data = request.getParam("data"); if (StringUtil.isBlank(data)) { return CommandResponse.ofFailure(new IllegalArgumentException("Bad data")); } try { data = URLDecoder.decode(data, "utf-8"); } catch (Exception e) { RecordLog.info("Decode gateway rule data error", e); return CommandResponse.ofFailure(e, "decode gateway rule data error"); } RecordLog.info(String.format("[API Server] Receiving rule change (type: gateway rule): %s", data)); String result = SUCCESS_MSG; Set<GatewayFlowRule> flowRules = JSON.parseObject(data, new TypeReference<Set<GatewayFlowRule>>() { }); GatewayRuleManager.loadRules(flowRules); if (!writeToDataSource(gatewayFlowWds, flowRules)) { result = WRITE_DS_FAILURE_MSG; } return CommandResponse.ofSuccess(result); }
Example 2
Source File: ClusterStateManager.java From Sentinel with Apache License 2.0 | 6 votes |
private static boolean startServer() { try { ClusterTokenClient tokenClient = TokenClientProvider.getClient(); if (tokenClient != null) { tokenClient.stop(); } EmbeddedClusterTokenServer server = EmbeddedClusterTokenServerProvider.getServer(); if (server != null) { server.start(); RecordLog.info("[ClusterStateManager] Changing cluster mode to server"); return true; } else { RecordLog.warn("[ClusterStateManager] Cannot change to server (no server SPI found)"); return false; } } catch (Exception ex) { RecordLog.warn("[ClusterStateManager] Error when changing cluster mode to server", ex); return false; } }
Example 3
Source File: MetricWriter.java From Sentinel with Apache License 2.0 | 6 votes |
public MetricWriter(long singleFileSize, int totalFileCount) { if (singleFileSize <= 0 || totalFileCount <= 0) { throw new IllegalArgumentException(); } RecordLog.info( "[MetricWriter] Creating new MetricWriter, singleFileSize=" + singleFileSize + ", totalFileCount=" + totalFileCount); this.baseDir = METRIC_BASE_DIR; File dir = new File(baseDir); if (!dir.exists()) { dir.mkdirs(); } long time = System.currentTimeMillis(); this.lastSecond = time / 1000; this.singleFileSize = singleFileSize; this.totalFileCount = totalFileCount; try { this.timeSecondBase = df.parse("1970-01-01 00:00:00").getTime() / 1000; } catch (Exception e) { RecordLog.warn("[MetricWriter] Create new MetricWriter error", e); } }
Example 4
Source File: SimpleHttpHeartbeatSender.java From Sentinel with Apache License 2.0 | 5 votes |
public SimpleHttpHeartbeatSender() { // Retrieve the list of default addresses. List<Tuple2<String, Integer>> newAddrs = TransportConfig.getConsoleServerList(); if (newAddrs.isEmpty()) { RecordLog.warn("[SimpleHttpHeartbeatSender] Dashboard server address not configured or not available"); } else { RecordLog.info("[SimpleHttpHeartbeatSender] Default console address list retrieved: " + newAddrs); } this.addressList = newAddrs; }
Example 5
Source File: SentinelConfigLoader.java From Sentinel with Apache License 2.0 | 5 votes |
private static void load() { // Order: system property -> system env -> default file (classpath:sentinel.properties) -> legacy path String fileName = System.getProperty(SENTINEL_CONFIG_PROPERTY_KEY); if (StringUtil.isBlank(fileName)) { fileName = System.getenv(SENTINEL_CONFIG_ENV_KEY); if (StringUtil.isBlank(fileName)) { fileName = DEFAULT_SENTINEL_CONFIG_FILE; } } Properties p = ConfigUtil.loadProperties(fileName); if (p != null && !p.isEmpty()) { RecordLog.info("[SentinelConfigLoader] Loading Sentinel config from " + fileName); properties.putAll(p); } for (Map.Entry<Object, Object> entry : new CopyOnWriteArraySet<>(System.getProperties().entrySet())) { String configKey = entry.getKey().toString(); String newConfigValue = entry.getValue().toString(); String oldConfigValue = properties.getProperty(configKey); properties.put(configKey, newConfigValue); if (oldConfigValue != null) { RecordLog.info("[SentinelConfigLoader] JVM parameter overrides {}: {} -> {}", configKey, oldConfigValue, newConfigValue); } } }
Example 6
Source File: FlowRuleManager.java From Sentinel-Dashboard-Nacos with Apache License 2.0 | 5 votes |
@Override public void configLoad(List<FlowRule> conf) { Map<String, List<FlowRule>> rules = FlowRuleUtil.buildFlowRuleMap(conf); if (rules != null) { flowRules.clear(); flowRules.putAll(rules); } RecordLog.info("[FlowRuleManager] Flow rules loaded: " + flowRules); }
Example 7
Source File: ClusterClientConfigManager.java From Sentinel-Dashboard-Nacos with Apache License 2.0 | 5 votes |
public static void registerClientConfigProperty(SentinelProperty<ClusterClientConfig> property) { AssertUtil.notNull(property, "property cannot be null"); synchronized (CONFIG_PROPERTY_LISTENER) { RecordLog.info("[ClusterClientConfigManager] Registering new global client config property to " + "cluster client config manager"); clientConfigProperty.removeListener(CONFIG_PROPERTY_LISTENER); property.addListener(CONFIG_PROPERTY_LISTENER); clientConfigProperty = property; } }
Example 8
Source File: ConnectionPool.java From Sentinel with Apache License 2.0 | 5 votes |
public void refreshIdleTask() { if (scanTaskFuture == null || scanTaskFuture.cancel(false)) { startScan(); } else { RecordLog.info("The result of canceling scanTask is error."); } }
Example 9
Source File: ConnectionPool.java From Sentinel-Dashboard-Nacos with Apache License 2.0 | 5 votes |
public void refreshIdleTask() { if (scanTaskFuture == null || scanTaskFuture.cancel(false)) { startScan(); } else { RecordLog.info("The result of canceling scanTask is error."); } }
Example 10
Source File: ClusterStateManager.java From Sentinel-Dashboard-Nacos with Apache License 2.0 | 5 votes |
public static void registerProperty(SentinelProperty<Integer> property) { synchronized (PROPERTY_LISTENER) { RecordLog.info("[ClusterStateManager] Registering new property to cluster state manager"); stateProperty.removeListener(PROPERTY_LISTENER); property.addListener(PROPERTY_LISTENER); stateProperty = property; } }
Example 11
Source File: RecordLogTest.java From Sentinel-Dashboard-Nacos with Apache License 2.0 | 5 votes |
@Test public void testLogRolling() { int count = 1000; while (--count > 0) { RecordLog.info("Count " + count); } }
Example 12
Source File: SpiLoader.java From Sentinel with Apache License 2.0 | 5 votes |
/** * Load the sorted SPI instance list for provided SPI interface. * * Note: each call return same instances. * * @param clazz class of the SPI * @param <T> SPI type * @return sorted SPI instance list * @since 1.6.0 */ public static <T> List<T> loadInstanceListSorted(Class<T> clazz) { try { String key = clazz.getName(); // Not thread-safe, as it's expected to be resolved in a thread-safe context. ServiceLoader<T> serviceLoader = SERVICE_LOADER_MAP.get(key); if (serviceLoader == null) { serviceLoader = ServiceLoaderUtil.getServiceLoader(clazz); SERVICE_LOADER_MAP.put(key, serviceLoader); } List<SpiOrderWrapper<T>> orderWrappers = new ArrayList<>(); for (T spi : serviceLoader) { int order = SpiOrderResolver.resolveOrder(spi); // Since SPI is lazy initialized in ServiceLoader, we use online sort algorithm here. SpiOrderResolver.insertSorted(orderWrappers, spi, order); RecordLog.info("[SpiLoader] Found {} SPI: {} with order {}", clazz.getSimpleName(), spi.getClass().getCanonicalName(), order); } List<T> list = new ArrayList<>(orderWrappers.size()); for (int i = 0; i < orderWrappers.size(); i++) { list.add(orderWrappers.get(i).spi); } return list; } catch (Throwable t) { RecordLog.error("[SpiLoader] ERROR: loadInstanceListSorted failed", t); t.printStackTrace(); return new ArrayList<>(); } }
Example 13
Source File: HttpHeartbeatSender.java From Sentinel-Dashboard-Nacos with Apache License 2.0 | 5 votes |
public HttpHeartbeatSender() { this.client = HttpClients.createDefault(); List<Tuple2<String, Integer>> dashboardList = parseDashboardList(); if (dashboardList == null || dashboardList.isEmpty()) { RecordLog.info("[NettyHttpHeartbeatSender] No dashboard available"); } else { consoleHost = dashboardList.get(0).r1; consolePort = dashboardList.get(0).r2; RecordLog.info("[NettyHttpHeartbeatSender] Dashboard address parsed: <" + consoleHost + ':' + consolePort + ">"); } }
Example 14
Source File: RedisDataSource.java From Sentinel-Dashboard-Nacos with Apache License 2.0 | 5 votes |
/** * Build Redis client fromm {@code RedisConnectionConfig}. * * @return a new {@link RedisClient} */ private RedisClient getRedisClient(RedisConnectionConfig connectionConfig) { if (connectionConfig.getRedisSentinels().size() == 0) { RecordLog.info("[RedisDataSource] Creating stand-alone mode Redis client"); return getRedisStandaloneClient(connectionConfig); } else { RecordLog.info("[RedisDataSource] Creating Redis Sentinel mode Redis client"); return getRedisSentinelClient(connectionConfig); } }
Example 15
Source File: AuthorityRuleManager.java From Sentinel-Dashboard-Nacos with Apache License 2.0 | 5 votes |
@Override public void configLoad(List<AuthorityRule> value) { Map<String, Set<AuthorityRule>> rules = loadAuthorityConf(value); authorityRules.clear(); if (rules != null) { authorityRules.putAll(rules); } RecordLog.info("[AuthorityRuleManager] Load authority rules: " + authorityRules); }
Example 16
Source File: SentinelZuulErrorFilter.java From Sentinel with Apache License 2.0 | 5 votes |
@Override public Object run() throws ZuulException { RequestContext ctx = RequestContext.getCurrentContext(); Throwable throwable = ctx.getThrowable(); if (throwable != null) { if (!BlockException.isBlockException(throwable)) { // Trace exception for each entry and exit entries in order. // The entries can be retrieved from the request context. SentinelEntryUtils.tryTraceExceptionThenExitFromCurrentContext(throwable); RecordLog.info("[SentinelZuulErrorFilter] Trace error cause", throwable.getCause()); } } return null; }
Example 17
Source File: CommandCenterInitFunc.java From Sentinel-Dashboard-Nacos with Apache License 2.0 | 5 votes |
@Override public void init() throws Exception { CommandCenter commandCenter = CommandCenterProvider.getCommandCenter(); if (commandCenter == null) { RecordLog.warn("[CommandCenterInitFunc] Cannot resolve CommandCenter"); return; } commandCenter.beforeStart(); commandCenter.start(); RecordLog.info("[CommandCenterInit] Starting command center: " + commandCenter.getClass().getCanonicalName()); }
Example 18
Source File: SentinelDubboConsumerFilter.java From Sentinel-Dashboard-Nacos with Apache License 2.0 | 4 votes |
public SentinelDubboConsumerFilter() { RecordLog.info("Sentinel Dubbo consumer filter initialized"); }
Example 19
Source File: SentinelDubboProviderFilter.java From Sentinel with Apache License 2.0 | 4 votes |
public SentinelDubboProviderFilter() { RecordLog.info("Sentinel Apache Dubbo provider filter initialized"); }
Example 20
Source File: ConfigSupplierRegistry.java From Sentinel-Dashboard-Nacos with Apache License 2.0 | 4 votes |
public static void setNamespaceSupplier(Supplier<String> namespaceSupplier) { AssertUtil.notNull(namespaceSupplier, "namespaceSupplier cannot be null"); ConfigSupplierRegistry.namespaceSupplier = namespaceSupplier; RecordLog.info("[ConfigSupplierRegistry] New namespace supplier provided, current supplied: " + namespaceSupplier.get()); }