To change a handlers log level:
Changing the level on a log category is the same:
- Create a file handler. There are 3 different types of file handlers to choose from; file-handler, periodic-rotating-file-handler and size-rotating-file-handler. In this example we'll just use a simple file-handler.
- Now create the log category.
First note that if you choose to use a log4j configuration file, you will no longer be able to change the log4j logging configuration at runtime.
- Create a jboss-deployment-structure.xml with the following content and place it in the META-INF/ directory if you are deploying an EAR and also on META-INF/ or WEB-INF/ directory if you are deploying a WAR.
- Include the log4j.properties or log4j.xml file in the lib/ directory in your deployment.
- Deploy your application.