示例#1
0
        /**
         * 添加日志服务
         *
         * @param filePath
         */
        public void addFileAppender(String filePath)
        {
            int index = filePath.LastIndexOf(FILESEPARATOR);

            if (index < 0)
            {
                filePath = FILESEPARATOR + "log" + FILESEPARATOR + filePath;
            }
            FileAppenderConfig fileAppenderConfig = new FileAppenderConfig();

            fileAppenderConfig.m_logFile     = filePath;
            fileAppenderConfig.m_name        = "FileAppender";
            fileAppenderConfig.m_type        = "FileAppender";
            fileAppenderConfig.m_datePattern = "yyyy-MM-dd HH:mm:ss";
            fileAppenderConfig.m_logType     = 1;
            FileAppender appender = new FileAppender(fileAppenderConfig);

            appender.m_id = getNewAppenderId();
            addAppender(appender);
        }
示例#2
0
 /**
  * 指定配置文件的位置
  *
  * @param configPath
  */
 public FileAppender(String configPath)
 {
     m_fileAppenderConfig = new FileAppenderConfig();
     m_fileAppenderConfig.loadConfig(configPath);
     checkDirectory(m_fileAppenderConfig.m_logFile);
 }
示例#3
0
 /**
  * 指定一个配置文件FileAppenderConfig
  *
  * @param fileAppenderConfig
  */
 public FileAppender(FileAppenderConfig fileAppenderConfig)
 {
     m_fileAppenderConfig = fileAppenderConfig;
     checkDirectory(m_fileAppenderConfig.m_logFile);
 }