2

我正在使用jboss-6.1.0.Final,当我启动我的服务器时,日志文件(boot.log)的大小越来越大,第一次增加了 16GB。

我停止我的应用程序服务器并再次启动,但问题仍然存在......!文件大小为 20GB 和 16GB。

我谷歌很多...!我在 server.log 的 {JBOSS_HOME}\server\server_name\deploy\jboss-logging.xml 中找到了以下属性。

   <size-rotating-file-handler
         file-name="${jboss.server.log.dir}/server.log"
         name="FILE"
         autoflush="true"
         append="true"
         rotate-size="500k"
         max-backup-index="2">

      <error-manager>
         <only-once/>
      </error-manager>

      <formatter>
         <pattern-formatter pattern="%d %-5p [%c] (%t) %m%n"/>
      </formatter>
   </size-rotating-file-handler>

我改变

file-name="${jboss.server.log.dir}/server.log"

file-name="${jboss.server.log.dir}/boot.log"

但它不工作......这样做是正确的方法......?或任何其他方式来实现相同的

这是我的 jboss-logging.xml

<?xml version="1.0" encoding="UTF-8"?>

<!-- ===================================================================== -->
<!--                                                                       -->
<!--  Logging System Configuration                                         -->
<!--                                                                       -->
<!-- ===================================================================== -->

<logging xmlns="urn:jboss:logging:6.0" xmlns:b="urn:jboss:bean-deployer:2.0">

   <!-- ================================= -->
   <!-- Preserve messages in a local file -->
   <!-- ================================= -->

   <!-- A time/date based rolling handler -->

   <periodic-rotating-file-handler
         file-name="${jboss.server.log.dir}/server.log"
         name="FILE"
         autoflush="true"
         append="true"
         suffix=".yyyy-MM-dd">  <!-- To roll over at the top of each hour, use ".yyyy-MM-dd-HH" instead -->

      <error-manager>
         <only-once/>
      </error-manager>

      <formatter>
         <!-- To revert back to simple stack traces without JAR versions, change "%E" to "%e" below. -->
         <!-- Uncomment this to get the class name in the log as well as the category
         <pattern-formatter pattern="%d %-5p [%c] %C{1} (%t) %s%E%n"/>
         -->
         <!-- Uncomment this to log without the class name in the log -->
         <pattern-formatter pattern="%d %-5p [%c] (%t) %s%E%n"/>
      </formatter>
   </periodic-rotating-file-handler>

   <!-- A size based file rolling appender

   <size-rotating-file-handler
         file-name="${jboss.server.log.dir}/server.log"
         name="FILE"
         autoflush="true"
         append="true"
         rotate-size="500k"
         max-backup-index="5">

      <error-manager>
         <only-once/>
      </error-manager>

      <formatter>
         <pattern-formatter pattern="%d %-5p [%c] (%t) %m%n"/>
      </formatter>
   </size-rotating-file-handler>
   -->

   <!-- ============================== -->
   <!-- Append messages to the console -->
   <!-- ============================== -->

   <console-handler name="CONSOLE" autoflush="true" target="System.out">
      <error-manager>
         <only-once/>
      </error-manager>

      <level name="INFO"/>

      <formatter>
         <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] %s%E%n"/>
      </formatter>
   </console-handler>

   <!-- ====================== -->
   <!-- More Appender examples -->
   <!-- ====================== -->

   <!-- Buffer events and log them asynchronously

   <async-handler name="ASYNC">
      <error-manager>
         <only-once/>
      </error-manager>

      <sub-handlers>
         <handler-ref name="FILE"/>
         <handler-ref name="CONSOLE"/>
         <handler-ref name="SMTP"/>
      </sub-handlers>
   </async-handler>
   -->

   <!-- EMail events to an administrator

   <log4j-appender name="SMTP" class="org.apache.log4j.net.SMTPAppender">
      <error-manager>
         <only-once/>
      </error-manager>

      <level name="ERROR"/>

      <properties>
         <property name="to">admin@myhost.domain.com</property>
         <property name="from">nobody@myhost.domain.com</property>
         <property name="subject">JBoss Sever Errors</property>
         <property name="SMTPHost">localhost</property>
         <property name="bufferSize">10</property>
      </properties>

      <formatter>
         <pattern-formatter pattern="%d %-5p [%c] (%t) %m%n"/>
      </formatter>
   </log4j-appender>
   -->

   <!-- Syslog events

   <log4j-appender name="SYSLOG" class="org.apache.log4j.net.SyslogAppender">
      <error-manager>
         <only-once/>
      </error-manager>

      <properties>
         <property name="facility">LOCAL7</property>
         <property name="facilityPrinting">true</property>
         <property name="syslogHost">localhost</property>
      </properties>

      <formatter>
         <pattern-formatter pattern="[%d,%c{1}] %m%n"/>
      </formatter>
   </log4j-appender>
   -->

   <!-- Log events to JMS (requires a topic to be created)

   <log4j-appender name="JMS" class="org.apache.log4j.net.JMSAppender">
      <error-manager>
         <only-once/>
      </error-manager>

      <level name="ERROR"/>

      <properties>
         <property name="topicConnectionFactoryBindingName">
            --><!-- Use injection so that an implicit dependency is formed - TODO: get the correct property name --><!--
            <b:inject bean="myTopicBiding" property="name"/>
         </property>
         <property name="topicBindingName">topic/MyErrorsTopic</property>
      </properties>
   </log4j-appender>
   -->

   <!-- Log events through SNMP

   <log4j-appender name="TRAP_LOG" class="org.apache.log4j.ext.SNMPTrapAppender">
      <error-manager>
         <only-once/>
      </error-manager>

      <level name="DEBUG"/>

      <properties>
         <property name="implementationClassName">org.apache.log4j.ext.JoeSNMPTrapSender</property>
         <property name="managementHost">127.0.0.1</property>
         <property name="managementHostTrapListenPort">162</property>
         <property name="enterpriseOID">1.3.6.1.4.1.24.0</property>
         <property name="localIPAddress">127.0.0.1</property>
         <property name="localTrapSendPort">161</property>
         <property name="genericTrapType">6</property>
         <property name="specificTrapType">12345678</property>
         <property name="communityString">public</property>
         <property name="forwardStackTraceWithTrap">true</property>
         <property name="applicationTrapOID">1.3.6.1.4.1.24.12.10.22.64</property>
      </properties>
      <formatter>
         <pattern-formatter pattern="%d,%p,[%t],[%c],%m%n"/>
      </formatter>
   </log4j-appender>
   -->

   <!-- Emit events as JMX notifications

   <log4j-appender name="JMX" class="org.jboss.monitor.services.JMXNotificationAppender">
      <error-manager>
         <only-once/>
      </error-manager>

      <level name="WARN"/>

      <properties>
         <property name="objectName">jboss.system:service=Logging,type=JMXNotificationAppender</property>
      </properties>

      <formatter>
         <pattern-formatter pattern="%d %-5p [%c] %m"/>
      </formatter>
   </log4j-appender>
   -->

   <!-- Security AUDIT Appender

   <periodic-rotating-file-handler
         name="AUDIT"
         autoflush="true"
         file-name="${jboss.server.log.dir}/audit.log"
         suffix=".yyyy-MM-dd"
         append="true">

      <error-manager>
         <only-once/>
      </error-manager>

      <formatter>
         <pattern-formatter pattern="%d %-5p [%c] (%t:%x) %m%n"/>
      </formatter>
   </periodic-rotating-file-handler>
   -->

   <!-- =============================================== -->
   <!-- Limit categories                                -->
   <!-- if enabling "trace" at root logger level,       -->
   <!-- use limit category settings to disable trace    -->
   <!-- for packages that you don't want to trace       -->
   <!-- =============================================== -->

   <!-- Limit the org.apache category to INFO as its DEBUG is verbose -->
   <logger category="org.apache">
      <level name="INFO"/>
   </logger>

   <!-- Limit the jacorb category to WARN as its INFO is verbose -->
   <logger category="jacorb">
      <level name="WARN"/>
   </logger>

   <!-- Limit JSF to INFO as its FINE is verbose -->
   <logger category="javax.enterprise.resource.webcontainer.jsf">
      <level name="INFO"/>
   </logger>

   <!-- Limit the org.jgroups category to WARN as its INFO is verbose -->
   <logger category="org.jgroups">
      <level name="WARN"/>
   </logger>

   <!-- Limit the org.quartz category to INFO as its DEBUG is verbose -->
   <logger category="org.quartz">
      <level name="INFO"/>
   </logger>

   <!-- Limit the com.sun category to INFO as its FINE is verbose -->
   <logger category="com.sun">
      <level name="INFO"/>
   </logger>

   <!-- Limit the sun category to INFO as its FINE is verbose -->
   <logger category="sun">
      <level name="INFO"/>
   </logger>

   <!-- Limit the javax.xml.bind category to INFO as its FINE is verbose -->
   <logger category="javax.xml.bind">
      <level name="INFO"/>
   </logger>

   <!-- Limit the springframework category to WARN-->
   <logger category="org.springframework">
      <level name="WARN"/>
   </logger>

   <!-- Limit JBoss categories
   <logger category="org.jboss">
      <level name="INFO"/>
   </logger>
   -->

   <!-- Or limit individual JBoss categories
   <logger category="org.jboss.web">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.tm">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.jdbc">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.on">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.services">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.bootstrap">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.kernel">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.beans">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.injection">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.annotation">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.system">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.mx">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.jmx">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.invocation">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.classloader">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.classloading">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.deployment">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.deployers">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.dependency">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.metadata">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.detailed">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.logging">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.logbridge">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.aop">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.joinpoint">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.util">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.ha">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.resource">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.varia">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.net">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.security">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.console">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.wsf">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.ejb">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.ejb3">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.jpa">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.vfs">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.xb">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.naming">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.wsf">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.ws">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.mail">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.monitor">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.remoting">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.profileservice">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.cache">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.proxy">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.jms">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.messaging">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.webbeans">
     <level name="INFO" />
   </logger>

   <logger category="org.jboss.managed">
     <level name="INFO" />
   </logger>
   -->

   <!-- Limit Arjuna transaction manager -->
   <logger category="com.arjuna.ats">
     <level name="INFO" />
   </logger>

   <!-- Limit Hibernate
   <logger category="org.hibernate">
     <level name="INFO" />
   </logger>
   -->

   <!-- Limit Ajax4jsf
   <logger category="org.ajax4jsf">
     <level name="INFO" />
   </logger>
   -->

   <!-- Limit JNP
    <logger category="org.jnp">
      <level name="INFO" />
    </logger>
   -->


   <!-- Limit the JSR77 categories -->
   <logger category="org.jboss.management">
      <level name="INFO"/>
   </logger>

   <!-- Limit the verbose facelets compiler -->
   <!-- Also suppress error with legacy facelets (JBAS-7600) -->
   <logger category="facelets.compiler">
      <level name="WARN"/>
      <filter>
         <not>
            <match pattern="Error\sLoading\sLibrary.*jsf-libs/jsf-impl"/>
         </not>
      </filter>
   </logger>


   <!-- Limit the verbose ajax4jsf cache initialization
   <logger category="org.ajax4jsf.cache">
      <level name="WARN"/>
   </logger>
   -->
   <!-- Limit the verbose embedded jopr categories
   <logger category="org.rhq">
      <level name="WARN"/>
   </logger>
   -->
   <!-- Limit the verbose seam categories
   <logger category="org.jboss.seam">
      <level name="WARN"/>
   </logger>
   -->

   <!-- Show the evolution of the DataSource pool in the logs [inUse/Available/Max]
   <logger category="org.jboss.resource.connectionmanager.JBossManagedConnectionPool">
     <level name="TRACE"/>
   </logger>
   -->

   <!-- Category specifically for Security Audit Provider
   <logger category="org.jboss.security.audit.providers.LogAuditProvider" additivity="false">
     <level name="TRACE"/>
     <appender-ref ref="AUDIT"/>
   </logger>
   -->

   <!-- Limit the org.jboss.serial (jboss-serialization) to INFO as its DEBUG is verbose -->
   <logger category="org.jboss.serial">
      <level name="INFO"/>
   </logger>

   <!-- Decrease the priority threshold for the org.jboss.varia category
   <logger category="org.jboss.varia">
     <level name="DEBUG"/>
   </logger>
   -->

   <!-- Enable JBossWS message tracing
   <logger category="org.jboss.ws.core.MessageTrace">
     <level name="TRACE"/>
   </logger>
   -->

   <!-- Enable System log message tracing
   <logger category="org.jboss.system">
     <level name="TRACE"/>
   </logger>
   <logger category="org.jboss.ejb.plugins">
     <level name="TRACE"/>
   </logger>
   -->

   <!--
       | Logs these events to SNMP:
           - server starts/stops
           - cluster evolution (node death/startup)
           - When an EJB archive is deployed (and associated verified messages)
           - When an EAR archive is deployed

   <logger category="org.jboss.system.server.Server">
      <level name="INFO"/>
      <handlers>
         <handler-ref name="TRAP_LOG"/>
      </handlers>
   </logger>

   <logger category="org.jboss.ha.framework.interfaces.HAPartition.lifecycle">
      <level name="INFO"/>
      <handlers>
         <handler-ref name="TRAP_LOG"/>
      </handlers>
   </logger>

   <logger category="org.jboss.deployment.MainDeployer">
      <level name="ERROR"/>
      <handlers>
         <handler-ref name="TRAP_LOG"/>
      </handlers>
   </logger>

   <logger category="org.jboss.ejb.EJBDeployer">
      <level name="INFO"/>
      <handlers>
         <handler-ref name="TRAP_LOG"/>
      </handlers>
   </logger>

   <logger category="org.jboss.deployment.EARDeployer">
      <level name="INFO"/>
      <handlers>
         <handler-ref name="TRAP_LOG"/>
      </handlers>
   </logger>
   -->

    <!-- Reduce org.mc4j stuff in the logs -->
   <logger category="org.mc4j">
      <level name="WARN"/>
   </logger>

   <!-- Clustering logging -->
   <!-- Uncomment the following to redirect the org.jgroups and
      org.jboss.ha categories to a cluster.log file.

   <size-rotating-file-handler
         file-name="${jboss.server.log.dir}/cluster.log"
         name="CLUSTER"
         append="false"
         rotate-size="500k"
         max-backup-index="5"
         autoflush="true">

      <error-manager>
         <only-once/>
      </error-manager>

      <formatter>
         <pattern-formatter pattern="%d %-5p [%c] %m%n"/>
      </formatter>
   </size-rotating-file-handler>

   <logger category="org.jgroups">
      <level name="DEBUG" />
      <handlers>
         <handler-ref name="CLUSTER"/>
      </handlers>
   </logger>

   <logger category="org.jboss.ha">
      <level name="DEBUG" />
      <handlers>
         <handler-ref name="CLUSTER"/>
      </handlers>
   </logger>
   -->

   <!-- This is a temporary workaround for https://jira.jboss.org/jira/browse/EMBJOPR-280 and
        should be removed once that bug if fixed in the bundled admin-console war. -->
   <logger category="org.rhq.plugins.jbossas5.ApplicationServerComponent">
      <level name="FATAL"/>
   </logger>

   <!-- ======================= -->
   <!-- Setup the Root category -->
   <!-- ======================= -->

   <root-logger>
      <!-- Set the root logger priority via a system property, with a default value. -->
      <level name="${jboss.server.log.threshold:INFO}"/>
      <handlers>
         <handler-ref name="CONSOLE"/>
         <handler-ref name="FILE"/>
      </handlers>
   </root-logger>

</logging>

这是 logging.properties

# Additional logger names to configure (root logger is always configured)
#loggers=org.jboss.whatever,org.jboss.foo
loggers=org.jboss.system.server.ServerInfo

# Root logger level
logger.level=${jboss.boot.server.log.level:INFO}
# Root logger handlers
logger.handlers=CONSOLE, FILE

# Allow debug logging from ServerInfo to get the system properties dump
logger.org.jboss.system.server.ServerInfo.level=${jboss.boot.server.log.serverinfo.level:DEBUG}

# Console handler configuration
handler.CONSOLE=org.jboss.logmanager.handlers.ConsoleHandler
handler.CONSOLE.properties=autoFlush
handler.CONSOLE.level=${jboss.boot.server.log.console.level:INFO}
handler.CONSOLE.autoFlush=true
handler.CONSOLE.formatter=PATTERN

# Boot log file handler configuration
handler.FILE=org.jboss.logmanager.handlers.FileHandler
handler.FILE.level=${jboss.boot.server.log.file.level:DEBUG}
handler.FILE.properties=autoFlush,fileName
handler.FILE.autoFlush=true
handler.FILE.fileName=${jboss.boot.server.log.dir}/boot.log
handler.FILE.formatter=PATTERN

# Formatter pattern configuration
formatter.PATTERN=org.jboss.logmanager.formatters.PatternFormatter
formatter.PATTERN.properties=pattern
formatter.PATTERN.pattern=%d{HH:mm:ss,SSS} %-5p [%c{1}] %s%E%n

如何控制boot.log文件的大小

任何人都面临同样的......谢谢......!

4

1 回答 1

2

在 logging.properties 中更改您的handler.FILE=org.jboss.logmanager.handlers.FileHandler

handler.FILE=org.jboss.logmanager.handlers.SizeRotatingFileHandler

于 2016-07-30T05:45:26.107 回答