The following sample script can be added to  your CLI scratchbook when you need to add a Logger on the fly for one package contained in your application

GOAL: create a custom logger for the package classes named com.sample. The logging information will be written in a custom File Handler that writes information in the file jboss.server.log.dir/customfile.log

In order to do that, we will at first:

  • Create a new logger "com.sample"
  • Define its logging level
  • Create the CustomFileHandler
  • Assign the CustomFileHandler the the "com.sample" logger
/subsystem=logging/logger=com.sample:write-attribute(name="level", value="DEBUG")


 Additionally, you might choose to re-use or not the root handler for your CustomFileHandler. With the following code we are not going to use the root handler:

/subsystem=logging/logger=com.sample:write-attribute(name="use-parent-handlers", value="false")

Related articles available on

How do I get the list of MBeans with twiddle?

  JBoss provides a simple command line tool that allows for inte

How to count active session with twiddle ?

  There are some well known alternatives to count the number of

How do I run garbage collector from shell?

  You can suggest JBoss to run the garbage collector in differen

How do I check my application status from shell?

  This is a two process step: at first you need to retrieve the

How do you shut down multiple JBoss instances?

  Supposing you have configured 2 instances of JBoss, one on por

twiddle reference guide

Please note: twiddle is not available any more as default Command