/**
* Initializes logging to a file.
* @param loggerNames the names of the loggers (usually names of packages
* or classes or ancestors of packages or classes). Can't be null.
* @param argMap command line arguments.
*/
public static synchronized void initFileLogging(String[] loggerNames, ArgumentMap argMap, String filename)
throws IOException
{
Level level = DEFAULT_FILE_LOGGING_LEVEL;
if (argMap.isSet(Argument.LOG_QUIET_SHORT) || argMap.isSet(Argument.LOG_QUIET)) level = Level.ERROR;
if (argMap.isSet(Argument.LOG_VERBOSE_SHORT) || argMap.isSet(Argument.LOG_VERBOSE)) level = Level.INFO;
if (argMap.isSet(Argument.LOG_DEBUG_SHORT) || argMap.isSet(Argument.DEBUG)) level = Level.DEBUG;
FileAppender fileAppender = new FileAppender(new PatternLayout(), filename);
boolean append = true;
Writer fileWriter = new FileWriter(filename, append);
for (String loggerName : loggerNames)
Log4jInit.setLevel(loggerName, level, fileWriter);
}
Util.java 文件源码
java
阅读 22
收藏 0
点赞 0
评论 0
项目:caom2
作者:
评论列表
文章目录