0

Environment:

  • Ubuntu 20.04
  • OpenJDK 11.0.12
  • ActiveMQ Artemis 2.25.0

My logging portion in broker.xml

<broker-plugins>
   <broker-plugin class-name="org.apache.activemq.artemis.core.server.plugin.impl.LoggingActiveMQServerPlugin">
      <property key="LOG_ALL_EVENTS" value="false"/>
      <property key="LOG_CONNECTION_EVENTS" value="false"/>
      <property key="LOG_SESSION_EVENTS" value="false"/>
      <property key="LOG_CONSUMER_EVENTS" value="false"/>
      <property key="LOG_DELIVERING_EVENTS" value="true"/>
      <property key="LOG_SENDING_EVENTS" value="false"/>
      <property key="LOG_INTERNAL_EVENTS" value="false"/>
   </broker-plugin>
</broker-plugins>

My logging.properties (key portion):

loggers=org.eclipse.jetty,org.jboss.logging,org.apache.activemq.artemis.core.server,org.apache.activemq.artemis.utils,org.apache.activemq.artemis.utils.critical,org.apache.activemq.artemis.journal,org.apache.activemq.artemis.jms.server,org.apache.activemq.artemis.integration.bootstrap,org.apache.activemq.audit.base,org.apache.activemq.audit.message,org.apache.activemq.audit.resource,org.apache.curator,org.apache.zookeeper,org.apache.activemq.artemis.core.server.plugin.impl

# Root logger level
logger.level=INFO
# ActiveMQ Artemis logger levels
logger.org.apache.activemq.artemis.core.server.level=INFO
logger.org.apache.activemq.artemis.journal.level=INFO
logger.org.apache.activemq.artemis.utils.level=INFO

logger.org.apache.activemq.artemis.core.server.plugin.impl.level=INFO
logger.org.apache.activemq.artemis.core.server.plugin.impl.handlers=LOGGING_PLUGIN
logger.org.apache.activemq.artemis.core.server.plugin.impl.useParentHandlers=false

# if you have issues with CriticalAnalyzer, setting this as TRACE would give you extra troubleshooting information.
# but do not use it regularly as it would incur in some extra CPU usage for this diagnostic.
logger.org.apache.activemq.artemis.utils.critical.level=INFO

logger.org.apache.activemq.artemis.jms.level=INFO
logger.org.apache.activemq.artemis.integration.bootstrap.level=INFO
logger.org.eclipse.jetty.level=WARN
# Root logger handlers
logger.handlers=FILE,CONSOLE

# quorum logger levels
logger.org.apache.curator.level=WARN
logger.org.apache.zookeeper.level=ERROR

# to enable audit change the level to INFO
logger.org.apache.activemq.audit.base.level=ERROR
logger.org.apache.activemq.audit.base.handlers=AUDIT_FILE
logger.org.apache.activemq.audit.base.useParentHandlers=false

logger.org.apache.activemq.audit.resource.level=ERROR
logger.org.apache.activemq.audit.resource.handlers=AUDIT_FILE
logger.org.apache.activemq.audit.resource.useParentHandlers=false

logger.org.apache.activemq.audit.message.level=ERROR
logger.org.apache.activemq.audit.message.handlers=AUDIT_FILE
logger.org.apache.activemq.audit.message.useParentHandlers=false

# Console handler configuration
handler.CONSOLE=org.jboss.logmanager.handlers.ConsoleHandler
handler.CONSOLE.properties=autoFlush
handler.CONSOLE.level=DEBUG
handler.CONSOLE.autoFlush=true
handler.CONSOLE.formatter=PATTERN

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

# plugin logger. Please refer to https://stackoverflow.com/questions/69037314/apache-artemis-logging-to-rotate-log-files
#handler.LOGGING_PLUGIN=org.jboss.logmanager.handlers.PeriodicRotatingFileHandler
handler.LOGGING_PLUGIN=org.jboss.logmanager.handlers.PeriodicSizeRotatingFileHandler
handler.LOGGING_PLUGIN.level=DEBUG
handler.LOGGING_PLUGIN.properties=suffix,append,autoFlush,fileName,rotateSize,maxBackupIndex
handler.LOGGING_PLUGIN.suffix=.yyyy-MM-dd
handler.LOGGING_PLUGIN.append=true
handler.LOGGING_PLUGIN.autoFlush=true
handler.LOGGING_PLUGIN.fileName=${artemis.instance}/log/consumer_events.log
handler.LOGGING_PLUGIN.formatter=PATTERN
handler.LOGGING_PLUGUN.rotateSize=10240000
handler.LOGGING_PLUGIN.maxBackupIndex=3

# Formatter pattern configuration
formatter.PATTERN=org.jboss.logmanager.formatters.PatternFormatter
formatter.PATTERN.properties=pattern
formatter.PATTERN.pattern=%d %-5p [%c] %s%E%n

But in the log folder it looks like below. You can see that the sizes of consumer_events.log(s) are always kept as around 65xxxx bytes. Obviously the property rotateSize doesn't work.

drwxr-xr-x  2 root root    189 Oct  5 14:27 ./
drwxr-xr-x 10 root root     96 Sep 30 09:52 ../
-rw-r--r--  1 root root 166068 Oct  5 14:20 artemis.log
-rw-r--r--  1 root root      0 Oct  5 09:32 audit.log
-rw-r--r--  1 root root 247931 Oct  5 14:20 consumer_events.log
-rw-r--r--  1 root root 656249 Oct  5 14:20 consumer_events.log.2022-10-05.1
-rw-r--r--  1 root root 656232 Oct  5 14:20 consumer_events.log.2022-10-05.2
-rw-r--r--  1 root root 655563 Oct  5 14:20 consumer_events.log.2022-10-05.3

How to let rotateSize work? Thanks

Justin Bertram
  • 29,372
  • 4
  • 21
  • 43
wureka
  • 731
  • 1
  • 11
  • 26

1 Answers1

1

The key portion of logging.properties you pasted has a critical typo:

handler.LOGGING_PLUGUN.rotateSize=10240000

Notice that it uses PLUGUN instead of PLUGIN. Try using this instead:

handler.LOGGING_PLUGIN.rotateSize=10240000
Justin Bertram
  • 29,372
  • 4
  • 21
  • 43