AMQ org.jboss.logmanager.handlers.SizeRotatingFileHandler not creating a log file

665 views Asked by At

AMQ 7 running on Linux Current default configuration:

handler.FILE=org.jboss.logmanager.handlers.PeriodicRotatingFileHandler
handler.FILE.level=DEBUG
handler.FILE.properties=suffix,append,autoFlush,fileName
handler.FILE.suffix=.yyyy-MM-dd
handler.FILE.append=true
handler.FILE.autoFlush=true
handler.FILE.fileName=${artemis.instance}/log/artemis.log
handler.FILE.formatter=PATTERN

Attempted to convert to:

handler.FILE=org.jboss.logmanager.handlers.SizeRotatingFileHandler
handler.FILE.level=DEBUG
handler.FILE.formatter=PATTERN
handler.FILE.properties=append,autoFlush,enabled,maxBackupIndex,rotateOnBoot,rotateSize,fileName
handler.FILE.append=true
handler.FILE.autoFlush=true
handler.FILE.enabled=true
handler.FILE.maxBackupIndex=2
handler.FILE.rotateOnBoot=true
handler.FILE.rotateSize=5K
handler.FILE.fileName=${artemis.instance}/log/artemis.log

Results in no log file being created.

Verified jboss-logmanager-2.0.7.Final-redhat-1.jar contains

6196 Defl:N 2786 55% 07-25-2017 04:59 16cae5b1 org/jboss/logmanager/handlers/SizeRotatingFileHandler.class

1

There are 1 answers

1
Justin Bertram On BEST ANSWER

When I use the configuration you specified I get this exception when I start the broker:

java.lang.NumberFormatException: For input string: "5K"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.lang.Long.parseLong(Long.java:589)
    at java.lang.Long.valueOf(Long.java:803)
    at org.jboss.logmanager.config.LogContextConfigurationImpl.getValue(LogContextConfigurationImpl.java:448)
    at org.jboss.logmanager.config.AbstractPropertyConfiguration$1.validate(AbstractPropertyConfiguration.java:205)
    at org.jboss.logmanager.config.AbstractPropertyConfiguration$1.validate(AbstractPropertyConfiguration.java:196)
    at org.jboss.logmanager.config.LogContextConfigurationImpl.doPrepare(LogContextConfigurationImpl.java:335)
    at org.jboss.logmanager.config.LogContextConfigurationImpl.prepare(LogContextConfigurationImpl.java:288)
    at org.jboss.logmanager.config.LogContextConfigurationImpl.commit(LogContextConfigurationImpl.java:297)
    at org.jboss.logmanager.PropertyConfigurator.configure(PropertyConfigurator.java:546)
    at org.jboss.logmanager.PropertyConfigurator.configure(PropertyConfigurator.java:97)
    at org.jboss.logmanager.LogManager.readConfiguration(LogManager.java:514)
    at org.jboss.logmanager.LogManager.readConfiguration(LogManager.java:476)
    at java.util.logging.LogManager$3.run(LogManager.java:399)
    at java.util.logging.LogManager$3.run(LogManager.java:396)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.util.logging.LogManager.readPrimordialConfiguration(LogManager.java:396)
    at java.util.logging.LogManager.access$800(LogManager.java:145)
    at java.util.logging.LogManager$2.run(LogManager.java:345)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.util.logging.LogManager.ensureLogManagerInitialized(LogManager.java:338)
    at java.util.logging.LogManager.getLogManager(LogManager.java:378)
    at java.util.logging.Logger.demandLogger(Logger.java:448)
    at java.util.logging.Logger.getLogger(Logger.java:502)
    at org.apache.activemq.artemis.boot.Artemis.<clinit>(Artemis.java:40)

The problem is this line of your configuration:

handler.FILE.rotateSize=5K

The code expects a valid Java long value which represents the number of bytes which are written to the file before rotating. 5K translates into 5120 (5 * 1024). When I used this value everything worked as expected.