示例#1
0
	std::string CFileLogger::GetFileAppenderName(log4cplus::Logger& logger)
	{
		std::string appedname = logger.getName() + "-f-";
		appedname += T2S(__LINE__);

		return appedname;
	}
示例#2
0
文件: Logger.cpp 项目: twilday09/HIRS
void Logger::setThresholdFromLoggingProperties(log4cplus::Logger logger) {
    // if logging.properties exists, attempt to set the
    // appropriate level for the given logger
    if (fileExists(PROP_FILE_LOC)) {
        Properties props(PROP_FILE_LOC);

        string loggerName = logger.getName();
        string logLevelKey = loggerName + ".level";
        if (props.isSet(logLevelKey)) {
            string level = props.get(logLevelKey);
            int l4cpLevel = log4cplus::getLogLevelManager().fromString(level);
            if (l4cpLevel != log4cplus::NOT_SET_LOG_LEVEL) {
                LOG4CPLUS_INFO(
                        logger,
                        LOG4CPLUS_TEXT(
                                "Configuring logger " + loggerName
                                + " with level " + level));
                logger.setLogLevel(l4cpLevel);
            } else {
                LOG4CPLUS_INFO(
                        logger,
                        LOG4CPLUS_TEXT(
                            "Unable to configure logger " + loggerName
                            + " with level " + level
                            + "; no such level found."));
            }
        }
    }
}