How to create size-rotating-file handler in JBoss 7.2 using CLI

There are times when we require a size-rotating-file handler over the default periodic-rotating-file handler. Simply changing the properties in standalone.xml won't do because it will cause synch problem with logging.properties. So to do so we need to execute a series of JBoss cli commands.

First you need to run: jboss_home/standalone/bin/jboss-cli.sh and connect.


//remove the default file handler
/subsystem=logging/periodic-rotating-file-handler=FILE:remove

//create the new file handler
/subsystem=logging/size-rotating-file-handler=FILE:add(file={"path"=>"server.log", "relative-to"=>"jboss.server.log.dir"})
/subsystem=logging/size-rotating-file-handler=FILE:write-attribute(name="autoflush", value="true")
/subsystem=logging/size-rotating-file-handler=FILE:write-attribute(name="level", value="WARN")
/subsystem=logging/size-rotating-file-handler=FILE:write-attribute(name="append", value="true")
/subsystem=logging/size-rotating-file-handler=FILE:write-attribute(name="max-backup-index", value="10")
/subsystem=logging/size-rotating-file-handler=FILE:write-attribute(name="rotate-size", value="5000k")

References:
https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Application_Platform/6/html/Administration_and_Configuration_Guide/Configure_a_Periodic_Log_Handler_in_the_CLI1.html
https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Application_Platform/6/html/Administration_and_Configuration_Guide/Sample_XML_Configuration_for_a_Size_Log_Handler.html

Related Posts:

  • Enable HTTPS / SSL for WildflyHere are the steps I run through to enable SSL / HTTPS for Wildfly 14.Notice that instead of generating a key / certificate pair we instead use a spec… Read More
  • Hadoop MapReduce DemoVersions:Hadoop 3.1.1 Java10Set the following environment variables:JAVA_HOME HADOOP_HOMEFor WindowsDownload Hadoop 3.1.1 binaries for windo… Read More
  • Social Login using REST FBThis is an implementation tutorial on how we can use REST FB to enable facebook social login on our web application.Basically, it's a project created … Read More
  • Microservices in SpringAnd so I was trying to learn microservices and since I'm from the JavaEE background it's given that I will first check: http://wildfly-swarm.io/t… Read More
  • Install Java8 in UbuntuA set of commands to install Java8 on Ubuntu.sudo add-apt-repository ppa:webupd8team/javasudo apt-get updatesudo apt-get install oracle-java8-installe… Read More

0 nhận xét:

Đăng nhận xét