0

I want to have 50 logs and the maximum size each log file can have is 11Mb,if log file name is portal.log, after portal.log reaches 11Mb, logs should be written to portal.log1 after that to portal.log2,....portal.log50 and after that to portal.log again ( logs should be rolled )

I have tried the following, the following configuration creates each log file a day if it creates portal.log.2016-03-31 today, tomorrow portal.log.2016-04-01 is created and portal.log.2016-04-02 on day after tomorrow and the file size is not limited to 11Mb also, the file keeps loading even after reaching a limit of 11Mb

<ns0:profile>
        <ns1:subsystem xmlns:ns1="urn:jboss:domain:logging:1.3">
            <ns1:console-handler name="CONSOLE">
                <ns1:level name="INFO" />
                <ns1:formatter>
                    <ns1:pattern-formatter pattern="%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n" />
                </ns1:formatter>
            </ns1:console-handler>
            <ns1:periodic-rotating-file-handler autoflush="true" name="FILE">
                <ns1:formatter>
                    <ns1:pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n" />
                </ns1:formatter>
                <ns1:file path="../../../../logs/portal.log" relative-to="jboss.server.log.dir" />
                <ns1:suffix value=".yyyy-MM-dd" />
                <ns1:append value="true" />
            </ns1:periodic-rotating-file-handler>
            <ns1:custom-handler name="filehandler" class="org.jboss.logmanager.handlers.PeriodicSizeRotatingFileHandler" module="org.jboss.logmanager">
            <ns1:formatter>
                <ns1:pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
            </ns1:formatter>
            <ns1:properties>
                <ns1:property name="maxBackupIndex" value="20"/>
                <ns1:property name="rotateSize" value="11534336"/> <!-- 11MB -->
                <ns1:property name="suffix" value=".yyyy-MM-dd"/>
                <ns1:property name="fileName" value="${jboss.server.log.dir}/portal.log"/>
            </ns1:properties>
            </ns1:custom-handler>
            <ns1:logger category="com.arjuna">
            <ns1:level name="WARN" />
            </ns1:logger>
            <ns1:logger category="org.apache.tomcat.util.modeler">
                <ns1:level name="WARN" />
            </ns1:logger>
            <ns1:logger category="org.jboss.as.config">
                <ns1:level name="DEBUG" />
            </ns1:logger>
            <ns1:logger category="sun.rmi">
                <ns1:level name="WARN" />
            </ns1:logger>
            <ns1:logger category="jacorb">
                <ns1:level name="WARN" />
            </ns1:logger>
            <ns1:logger category="jacorb.config">
                <ns1:level name="ERROR" />
            </ns1:logger>
            <ns1:logger category="org.jboss.security">
                <ns1:level name="TRACE" />
            </ns1:logger>
            <ns1:logger category="org.jboss.as.web.security">
                <ns1:level name="TRACE" />
            </ns1:logger>
            <ns1:logger category="org.apache.catalina">
                <ns1:level name="TRACE" />
            </ns1:logger>
     </ns1:subsystem>
<ns0:profile>

I am new to use jboss logging, can someone provide me the necessary inputs

user3607869
  • 317
  • 1
  • 9
  • 19

1 Answers1

0

You've got two file handlers defined. A periodic-rotating-file-handler and a custom-handler. The custom-handler could be changed to a size-rotating-file-handler. Have a look at the model reference for the attributes. You really only need one of them.

If you really want to update the XML directly there should be a schema in the $JBOSS_HOME/docs/schema. If you're on JBoss EAP 6.2 you'd need to look at the jboss-as-logging_1_3.xsd schema.

You also don't have the handlers assigned to any logger, or the root logger, so nothing will be logged at all. I'd advise having a look at the documentation as well.

James R. Perkins
  • 16,800
  • 44
  • 60
  • I have removed both the periodic rotating handler and custom handler and added size rotating file handler, which solved my issue – user3607869 Apr 05 '16 at 06:44