我在Geronimo上构建了一个Grails项目。我做了自己的log4j,每天写一些错误,它的尺寸很小。
我的问题是geronimo.out文件增加得太快了。它只需几天即可达到1Gb。我试图禁用控制台appender,但它仍然写入geronimo.out文件。
如何禁用它?
这是我的server-log4j.properties:
##
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements. See the NOTICE file distributed with
## this work for additional information regarding copyright ownership.
## The ASF licenses this file to You under the Apache License, Version 2.0
## (the "License"); you may not use this file except in compliance with
## the License. You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
## $Rev: 810770 $ $Date: 2009-09-03 11:32:24 +0800 (Thu, 03 Sep 2009) $
##
log4j.rootLogger=INFO
#log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
#log4j.appender.CONSOLE.Threshold=${org.apache.geronimo.log.ConsoleLogLevel}
#log4j.appender.CONSOLE.Target=System.out
#log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
#log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} %-5p [%c{1}] %m%n
#log4j.appender.FILE=org.apache.log4j.RollingFileAppender
#log4j.appender.FILE.Threshold=TRACE
#log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
#log4j.appender.FILE.layout.ConversionPattern=%d{ISO8601} %-5p [%c{1}] %m%n
#
# Note, changing log4j.appender.FILE.append=false will result in logs being
# overwritten without archiving the previous version of the log.
#
#log4j.appender.FILE.append=true
#log4j.appender.FILE.file=${org.apache.geronimo.server.dir}/var/log/geronimo.log
#log4j.appender.FILE.bufferedIO=false
#log4j.appender.FILE.maxBackupIndex=3
#log4j.appender.FILE.maxFileSize=10MB
#
# Example: enable trace logging from CONSOLE appender
#
#log4j.appender.CONSOLE.Threshold=TRACE#org.apache.geronimo.system.logging.log4j.XLevel
#
# Example: enable trace messages from foo.bar category
#
#log4j.logger.foo.bar=TRACE#org.apache.geronimo.system.logging.log4j.XLevel
# Geronimo
#This will help find connection leak problems
#log4j.logger.org.apache.geronimo.connector.outbound=TRACE#org.apache.geronimo.system.logging.log4j.XLevel
log4j.logger.org.apache.geronimo.system.logging.log4j.Log4jService=INFO
#### Eliminate any INFO level output during normal operation -- except the really relevant stuff ####
# We can change the Geronimo code to avoid this, but we have to just adjust the log levels for
# any third-party libraries.
log4j.logger.org.apache.commons.digester=ERROR
log4j.logger.org.apache.jasper.compiler.SmapUtil=WARN
# ActiveMQ
log4j.logger.org.apache.activemq=WARN
log4j.logger.org.apache.activemq.broker.jmx.ManagementContext=ERROR
# Don't need so much info on every web page that's rendered
log4j.logger.org.mortbay=INFO
log4j.logger.org.apache.pluto=INFO
log4j.logger.org.apache.jasper=INFO
# Various Jetty startup/shutdown output
log4j.logger.org.mortbay.http.HttpServer=WARN
log4j.logger.org.mortbay.http.SocketListener=WARN
log4j.logger.org.mortbay.http.ajp.AJP13Listener=WARN
log4j.logger.org.mortbay.util.Container=WARN
log4j.logger.org.mortbay.util.Credential=WARN
log4j.logger.org.mortbay.util.ThreadedServer=WARN
log4j.logger.org.mortbay.jetty.servlet.WebApplicationContext=WARN
log4j.logger.org.mortbay.jetty.context=WARN
# Various Tomcat startup output
log4j.logger.org.apache.catalina.realm.JAASRealm=WARN
log4j.logger.org.apache.catalina.realm.RealmBase=WARN
log4j.logger.org.apache.catalina.loader.WebappLoader=WARN
log4j.logger.org.apache.catalina.startup.Embedded=WARN
log4j.logger.org.apache.catalina.core.StandardEngine=WARN
log4j.logger.org.apache.catalina.core.StandardHost=WARN
log4j.logger.org.apache.jk.common.ChannelSocket=WARN
log4j.logger.org.apache.jk.server.JkMain=WARN
log4j.logger.org.apache.coyote.http11.Http11BaseProtocol=WARN
log4j.logger.org.apache.coyote.http11.Http11Protocol=WARN
log4j.logger.org.apache.catalina.core.ContainerBase=WARN
log4j.logger.org.apache.catalina.core.StandardContext=WARN
log4j.logger.org.apache.tomcat.util.net.SSLImplementation=WARN
# myfaces startup output
log4j.logger.org.apache.myfaces.renderkit.html.HtmlRenderKitImpl=WARN
log4j.logger.org.apache.myfaces.config.FacesConfigurator=WARN
log4j.logger.org.apache.myfaces.webapp.StartupServletContextListener=WARN
log4j.logger.org.apache.myfaces.webapp.StartupServletContextListener=WARN
# emits a spurious warn about null locale during startup of webapps
log4j.logger.org.apache.myfaces.shared_impl.util.LocaleUtils=ERROR
# Emits a spurious WARN during startup on /some-path/* security mappings
log4j.logger.org.apache.catalina.deploy.SecurityCollection=ERROR
# Prints the MBean Server ID
log4j.logger.javax.management.MBeanServerFactory=WARN
# Prints the RMI connection URL
log4j.logger.javax.management.remote.rmi.RMIConnectorServer=WARN
log4j.logger.javax.management.remote.JMXServiceURL=WARN
# Prints various stuff during startup
log4j.logger.org.apache.juddi.registry.RegistryServlet=WARN
# Prints various stuff when the portal is used
log4j.logger.org.apache.pluto.portalImpl.Servlet=WARN
# Prints various stuff when registering portlets for context
log4j.logger.org.apache.pluto.core.PortletContextManager=WARN
# Prints stuff for AJAX calls
log4j.logger.uk.ltd.getahead.dwr.impl.DefaultConfiguration=WARN
log4j.logger.uk.ltd.getahead.dwr.impl.ExecuteQuery=WARN
log4j.logger.uk.ltd.getahead.dwr.util.Logger=WARN
# Prints various stuff when loading mapping descriptors in pluto
log4j.logger.org.exolab.castor.mapping.Mapping=WARN
# Prints various stuff when filtering the requests.
log4j.logger.org.apache.geronimo.console.filter.XSRFHandler=WARN
# Example: enable Axis debug log output
#log4j.logger.org.apache.axis.enterprise=DEBUG
#log4j.logger.org.apache.axis.TIME=DEBUG
#log4j.logger.org.apache.axis.EXCEPTIONS=DEBUG
# Example: enable Axis2 debug log output
#log4j.logger.org.apache.axis2.enterprise=DEBUG
#log4j.logger.de.hunsicker.jalopy.io=DEBUG
#log4j.logger.httpclient.wire.header=DEBUG
#log4j.logger.org.apache.commons.httpclient=DEBUG
# Example: enable OpenJPA debug log output
#log4j.logger.openjpa.Runtime=TRACE
#log4j.logger.openjpa.Enhance=TRACE
#log4j.logger.openjpa.SQL=TRACE
#log4j.logger.openjpa=TRACE
提前致谢!
答案 0 :(得分:2)
尝试在登录文件时禁用输出到控制台。 从 Config.groovy 中删除 stdout Log4j ,如下所示:
root { info 'file','stdout'}
。
到
root { info 'file'}
。
希望它有效。