Tomcat和Liferay的log配置
Tomcat使用JDK的log包:
catalina.sh中设置logging配置文件-Djava.util.logging.config.file=%CATALINA_BASE%\conf\logging.properties,在该配置文件中设置了file和console的handler
相关实现类有org.apache.juli.logging包下的LogFactory和DirectJDKLog
其中catalina.out是个特殊的东西,它不是由logging包输出的,而是stdout(一般是console)被转存到了文件中去。由于默认logging.properties中都把consolehandler作为默认输出,所以只要是console上打出来的都会进这个文件。官方文档有一段详细说明:http://tomcat.apache.org/tomcat-6.0-doc/logging.html
如果不想要console输出,可以把直接去掉它。
.handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
com.liferay.portal.util.InitUtil if (GetterUtil.getBoolean(SystemProperties.get("log4j.configure.on.startup"), true)) {ClassLoader classLoader = InitUtil.class.getClassLoader();Log4JUtil.configureLog4J(classLoader.getResource("META-INF/portal-log4j.xml"));Log4JUtil.configureLog4J(classLoader.getResource("META-INF/portal-log4j-ext.xml"));}try {LogFactoryUtil.setLogFactory(new Log4jLogFactoryImpl());}catch (Exception e) {e.printStackTrace();}com.liferay.portal.kernel.log.LogFactoryUtilpublic static void setLogFactory(LogFactory logFactory) {for (Map.Entry entry : _logWrappers.entrySet()) {String name = entry.getKey();LogWrapper logWrapper = entry.getValue();logWrapper.setLog(logFactory.getLog(name));}_logFactory = logFactory;}private static volatile LogFactory _logFactory = new Jdk14LogFactoryImpl();