获得 Sofa Runtime 的日志对象，打印出获得配置中心地址
779418
private void printUserData(String dataId, UserData userData) {
        StringBuilder sb = new StringBuilder();
        int count = 0;
        if (userData != null && userData.getZoneData() != null) {
            Map<String, List<String>> oneUserData = userData.getZoneData();
            for (Map.Entry<String, List<String>> entry : oneUserData.entrySet()) {
                sb.append("  --- ").append(entry.getKey()).append("\n");
                for (String provider : entry.getValue()) {
                    sb.append("   >>> ").append((String) provider).append("\n");
                    ++count;
                }
            }
        }
        if (LOGGER.isInfoEnabled()) {
            LOGGER.info(LogCodes.getLog(LogCodes.INFO_ROUTE_REGISTRY_URLS_HANDLE,
                dataId, count, sb.toString()));
        }
    }
833987
@SuppressWarnings("deprecation")
    public VoltTable[] run(SystemProcedureExecutionContext ctx,
                           String username,
                           String remoteHost,
                           String xmlConfig)
    {
        long oldLevels  = 0;
        if (ctx.isLowestSiteId()) {
            // Logger level is a global property, pick the site with lowest id to do it.
            hostLog.info(String.format("%s from %s changed the log4j settings", username, remoteHost));
            hostLog.info(xmlConfig);
            oldLevels = hostLog.getLogLevels(loggers);
        }

        try {
            // Mimic the multi-fragment semantics as scatter-gather pattern is an overkill for this simple task.
            // There are chances that some sites being interrupted and update the logging before old logger level
            // being read, but the reasons we don't care because 1) it is rare and 2) it only effects when HOST
            // logger being changed from higher than INFO level to INFO or lower level.
            barrier.await();
        } catch (InterruptedException | BrokenBarrierException dontcare) { }

        VoltDB.instance().logUpdate(xmlConfig, DeprecatedProcedureAPIAccess.getVoltPrivateRealTransactionId(this),
                ctx.getPaths().getVoltDBRoot());
        ctx.updateBackendLogLevels();

        if (ctx.isLowestSiteId()) {
            long newLevels = hostLog.getLogLevels(loggers);
            if (newLevels != oldLevels) {
                // If HOST logger wasn't able to log before and now it can, logs the setting change event.
                int index = (int)((oldLevels >> 3) & 7);
                Level before = Level.values()[index];
                index = (int)((newLevels >> 3) & 7);
                Level after = Level.values()[index];
                if (before.ordinal() > Level.INFO.ordinal() && after.ordinal() <= Level.INFO.ordinal()) {
                    hostLog.info(String.format("%s from %s changed the log4j settings", username, remoteHost));
                    hostLog.info(xmlConfig);
                }
            }
            barrier.reset();
        }

        VoltTable t = new VoltTable(VoltSystemProcedure.STATUS_SCHEMA);
        t.addRow(VoltSystemProcedure.STATUS_OK);
        return (new VoltTable[] {t});
    }
1217175
function makeLoggers(path) {
    //创建日志目录，路径不存在
    if(!path) {
        console.error('path can not be null!');
    }

    //创建目录
    try {
        mkdirp.sync(path);
    } catch (err) {
        console.error(err);
        path = false;
    }
    
    //设置日志的参数
    var loggers = {};
    _.forEach(exports.config,function(v,k) {
        pathfile = path?(path+v.file):false;
        loggers[k] = configLogger(pathfile,v.level,v.trans,v.procs);
    });
    return loggers;
}
210785
function log() {
  var _console;

  for (var _len = arguments.length, msgs = Array(_len), _key = 0; _key < _len; _key++) {
    msgs[_key] = arguments[_key];
  }

  (_console = console).log.apply(_console, _toConsumableArray(['' + _config2.default.name].concat(msgs)));
}
1132053
public static void setJDKDebugEnabled(Boolean isEnabled) {
        //如果使用JDK14LOGGER，将业务日志级别设为DEBUG(FINE)
        if (blog instanceof Jdk14Logger) {
            Jdk14Logger logger = (Jdk14Logger) blog;
            if (isEnabled) {
                logger.getLogger().setLevel(Level.FINE);
                Handler consoleHandler = new ConsoleHandler();
                consoleHandler.setLevel(Level.FINE);
                logger.getLogger().addHandler(consoleHandler);
            } else {
                logger.getLogger().setLevel(Level.INFO);
            }
        }
    }
1135822
@Override
    public void doReportStat(SofaTracerSpan sofaTracerSpan) {
        //tags
        Map<String, String> tagsWithStr = sofaTracerSpan.getTagsWithStr();

        StatMapKey statKey = new StatMapKey();

        String fromApp = getFromApp(tagsWithStr);
        String toApp = getToApp(tagsWithStr);
        String zone = getZone(tagsWithStr);

        //service name
        String serviceName = tagsWithStr.get(RpcSpanTags.SERVICE);
        //method name
        String methodName = tagsWithStr.get(RpcSpanTags.METHOD);

        statKey.setKey(buildString(new String[] { fromApp, toApp, serviceName, methodName }));
        String resultCode = tagsWithStr.get(RpcSpanTags.RESULT_CODE);
        statKey.setResult(isSuccess(resultCode) ? "Y" : "N");
        statKey.setEnd(buildString(new String[] { getLoadTestMark(sofaTracerSpan), zone }));
        statKey.setLoadTest(TracerUtils.isLoadTest(sofaTracerSpan));

        statKey.addKey(RpcSpanTags.LOCAL_APP, tagsWithStr.get(RpcSpanTags.LOCAL_APP));
        statKey.addKey(RpcSpanTags.REMOTE_APP, tagsWithStr.get(RpcSpanTags.REMOTE_APP));
        statKey.addKey(RpcSpanTags.SERVICE, serviceName);
        statKey.addKey(RpcSpanTags.METHOD, methodName);
        //次数和耗时，最后一个耗时是单独打印的字段
        long duration = sofaTracerSpan.getEndTime() - sofaTracerSpan.getStartTime();
        long[] values = new long[] { 1, duration };
        this.addStat(statKey, values);
    }
190185
private void onLog(TableInfo tableInfo, CqlMetadata metadata, Map<ByteBuffer, String> value_types,
            CqlMetadata originalMetadata) throws CharacterCodingException
    {
        System.out.format("Persisted Schema for " + tableInfo.getTableName());
        System.out.format("\n");

        System.out.format("Column Name: \t\t  Column name type");
        System.out.format("\n");

        printInfo(originalMetadata);

        System.out.format("\n");
        System.out.format("Mapped schema for " + tableInfo.getTableName());

        System.out.format("\n");
        System.out.format("Column Name: \t\t  Column name type");
        System.out.format("\n");
        printInfo(metadata);
    }
6301
def log(self, message):
        
        theLog = '[日志名:%s] [时间:%s] \n[内容:\n%s]\n\n' % (
                self.startName, timestamp_to_time(get_current_timestamp()),  message)
        if not self.fileName:
            print(theLog)
        else:
            # 由于这里有很多的线程都要经过这道线程锁的控制，所以不会出现问题
            self.check_log_file_size()
            self.__f.write(theLog)
992961
public static org.slf4j.Logger getLogger(String name, String appname) {
        //从"com/alipay/sofa/rpc/log"中获取 rpc 的日志配置并寻找对应logger对象,log 为默认添加的后缀
        if (name == null || name.isEmpty()) {
            return null;
        }

        Map<String, String> properties = new HashMap<String, String>();
        properties.put(APPNAME, appname == null ? "" : appname);
        SpaceId spaceId = new SpaceId(RPC_LOG_SPACE);
        if (appname != null) {
            spaceId.withTag(APPNAME, appname);
        }
        return LoggerSpaceManager.getLoggerBySpace(name, spaceId, properties);
    }
192315
function consoleLog(){
    console.log("byllllogl-" + h_p + "-" + p_p + " --- step_p:" 
    + step_p + " --- lockedPhase_p:" + lockedPhase_p + " --- lockedValue_p:" + lockedValue_p  + " --- waitingProposer:" + waitingProposer
    + " --- assocByzantinePhase:"+ JSON.stringify(assocByzantinePhase));
}
509708
def run_and_print_log(workflow, highlight=None):
    
    from noodles.run.threading.sqlite3 import run_parallel
    from noodles import serial

    import io
    import logging

    log = io.StringIO()
    log_handler = logging.StreamHandler(log)
    formatter = logging.Formatter('%(asctime)s - %(message)s')
    log_handler.setFormatter(formatter)

    logger = logging.getLogger('noodles')
    logger.setLevel(logging.INFO)
    logger.handlers = [log_handler]

    result = run_parallel(
        workflow, n_threads=4, registry=serial.base, db_file='tutorial.db',
        always_cache=True, echo_log=False)
    display_text(log.getvalue(), highlight or [], split_at=40)
    return result
457163
function heapUsageP(heapData, options) {
        return co(_heap, heapData, options);

        /**
         * 内部处理逻辑
         */
        function* _heap(heapData, options) {
            options = options || {};

            const rootIndex = heapData.snapshot.root_index || 0;
            let jsHeapSnapShot = yield heapSnapShotCalculateP(heapData, options);
            let leakPoint = peakLeakPoint(jsHeapSnapShot, rootIndex, options.limit);

            return { leakPoint, jsHeapSnapShot, rootIndex };
        }
    }
737019
def cli(env, date_min, date_max, obj_event, obj_id, obj_type, utc_offset, metadata, limit):
    
    columns = ['Event', 'Object', 'Type', 'Date', 'Username']

    event_mgr = SoftLayer.EventLogManager(env.client)
    user_mgr = SoftLayer.UserManager(env.client)
    request_filter = event_mgr.build_filter(date_min, date_max, obj_event, obj_id, obj_type, utc_offset)
    logs = event_mgr.get_event_logs(request_filter)
    log_time = "%Y-%m-%dT%H:%M:%S.%f%z"
    user_data = {}

    if metadata:
        columns.append('Metadata')

    row_count = 0
    click.secho(", ".join(columns))
    for log in logs:
        if log is None:
            click.secho('No logs available for filter %s.' % request_filter, fg='red')
            return

        user = log['userType']
        label = log.get('label', '')
        if user == "CUSTOMER":
            username = user_data.get(log['userId'])
            if username is None:
                username = user_mgr.get_user(log['userId'], "mask[username]")['username']
                user_data[log['userId']] = username
            user = username

        if metadata:
            metadata_data = log['metaData'].strip("\n\t")

            click.secho("'{0}','{1}','{2}','{3}','{4}','{5}'".format(
                log['eventName'],
                label,
                log['objectName'],
                utils.clean_time(log['eventCreateDate'], in_format=log_time),
                user,
                metadata_data))
        else:
            click.secho("'{0}','{1}','{2}','{3}','{4}'".format(
                log['eventName'],
                label,
                log['objectName'],
                utils.clean_time(log['eventCreateDate'], in_format=log_time),
                user))

        row_count = row_count + 1
        if row_count >= limit and limit != -1:
            return
109887
def main(host, port, timeout, itimeout, qsize, backlog, maxtry, bsize, verbose, logfile=None, logcfgfile=None, cfgfile=None):
    

    dict_cfg = {}
    if cfgfile:
        dict_cfg = app_config.get_config_by_file(cfgfile)

    def get_param(key, param, default):
        return param or dict_cfg.get(key, None) or default

    cfg = app_config.Config(
        address=(get_param("host", host, "localhost"), get_param("port", port, 3333)),
        timeout=get_param("timeout", timeout, 10),
        msg_size=get_param("bsize", bsize, 4096),
        max_try_turn=get_param("maxtry", maxtry, 3),
        backlog=get_param("backlog", backlog, 1024),
        max_queue_size=get_param("qsize", qsize, 100),
        endpoint_timeout=get_param("itimeout", itimeout, 60),
        verbose=get_param("verbose", verbose, 0),
        logfile=get_param("logfile", logfile, None),
        logcfgfile=get_param("logcfgfile", logcfgfile, None)
    )
    click.echo("Starting sockspy...")
    sockspy_main.run(cfg)
216901
function startUploadStateCheck(timeout, cb) {
    var checkTimer = null;

    /**
     * 每10ms检测一次uploading状态，当前没有上传任务时，uploading为0
     * @return {[type]} [description]
     */
    function checkUplodingStatus() {
        checkTimer = setInterval(function () {
            if (uploading === 0 && checkTimer) {
                clearInterval(checkTimer);
                checkTimer = null;
                // 检测通过，开始检测50ms内是否还有新请求
                waitforNewUpload();
            }
        }, 10);
    }

    /**
     * 判断20ms内是否还有新增的上传请求，如果有则回到uploding检测状态
     * @return {[type]} [description]
     */
    function waitforNewUpload() {
        var periodTotal = total;
        setTimeout(function () {
            if (periodTotal === total) {
                debuglog('detect upload end');
                end();
            }
            else {
                debuglog('restart upload detect', periodTotal, total);
                checkUplodingStatus(cb);
            }
        }, 50);
    }

    function end() {
        globalCheckSatus = false;
        clearTimeout(uploadTimeout);
        uploadTimeout = null;
        clearInterval(checkTimer);
        checkTimer = null;
        total = 0;
        cb && cb();
    }

    if (globalCheckSatus) {
        return;
    }

    globalCheckSatus = true;

    checkUplodingStatus();

    // 上传整体超时检测
    var uploadTimeout = setTimeout(function () {
        debuglog('upload timeout');
        end();
    }, timeout * 1000);
}
149545
private static function initFramework()
    {
        static::$runtimeInfo = new RuntimeInfo;
        static::$container = new Container;
        // 初始化Main类
        static::initMains();
        // 设置临时子目录
        $subPath = Random::letterAndNumber(32, 32);
        // 注解处理
        static::$annotation = Annotation::getInstance();
        // 框架运行时缓存支持
        if('server/start' === $_SERVER['argv'][1])
        {
            $result = false;
        }
        else
        {
            // 尝试加载
            $result = App::loadRuntimeInfo(Imi::getRuntimePath('imi-runtime.cache'));
        }
        if(!$result)
        {
            // 不使用缓存时去扫描
            static::$annotation->init([
                MainHelper::getMain('Imi', 'Imi'),
            ]);
        }
        static::$isInited = true;
        Event::trigger('IMI.INITED');
    }
1109031
private void doDdl(DbLoadContext context, List<EventData> eventDatas) {
        for (final EventData data : eventDatas) {
            DataMedia dataMedia = ConfigHelper.findDataMedia(context.getPipeline(), data.getTableId());
            final DbDialect dbDialect = dbDialectFactory.getDbDialect(context.getIdentity().getPipelineId(),
                (DbMediaSource) dataMedia.getSource());
            Boolean skipDdlException = context.getPipeline().getParameters().getSkipDdlException();
            try {
                Boolean result = dbDialect.getJdbcTemplate().execute(new StatementCallback<Boolean>() {

                    public Boolean doInStatement(Statement stmt) throws SQLException, DataAccessException {
                        Boolean result = true;
                        if (dbDialect instanceof MysqlDialect && StringUtils.isNotEmpty(data.getDdlSchemaName())) {
                            // 如果mysql，执行ddl时，切换到在源库执行的schema上
                            // result &= stmt.execute("use " +
                            // data.getDdlSchemaName());

                            // 解决当数据库名称为关键字如"Order"的时候,会报错,无法同步
                            result &= stmt.execute("use `" + data.getDdlSchemaName() + "`");
                        }
                        result &= stmt.execute(data.getSql());
                        return result;
                    }
                });
                if (result) {
                    context.getProcessedDatas().add(data); // 记录为成功处理的sql
                } else {
                    context.getFailedDatas().add(data);
                }

            } catch (Throwable e) {
                if (skipDdlException) {
                    // do skip
                    logger.warn("skip exception for ddl : {} , caused by {}", data, ExceptionUtils.getFullStackTrace(e));
                } else {
                    throw new LoadException(e);
                }
            }

        }
    }