3 Replies Latest reply on Nov 14, 2014 3:56 PM by Wolf-Dieter Fink

    Using Log Categories in my Web App

    Daniel Castro Newbie

      I wish to make my app awarn of JBoss Log Categories such a way that when I go to http://localhost:9990/console and Add a Category used by my app and changes the log level from info to debug the app will start outputing info.  Today I use log4j but if I need to debug info I must redeploy the app with new definition of log level inside log4j.properties and I would like to make it runtime configurable.

       

      How can it be done in a pretty straightforward way?

      What are the configurations that should be done regarding jboss standalone.xml, property files on my app, deployment descriptors or coding?

        • 1. Re: Using Log Categories in my Web App
          Wolf-Dieter Fink Master

          In your application you can simple use a logging framework like log4J, slf4J or JBossLogging. You don't need to add any configuration.

          Now you can use the XML configuration or use the CLI during runtime to add the logger setting to your server configuration.

          If you use CLI this should be enabled during runtime.

          • 2. Re: Using Log Categories in my Web App
            Daniel Castro Newbie

            Doubts:

            1. Should the Log Category be declared using console be the same name as my Logger.getLogger("xxxxxx") uses?  This is the way I am doing.
            2. My console.log does not shows a thing.  My log4j.properties does not specifies that the appender should use an specii log file.

             

            So, in general lines, it is not working

            I changed the declaration of my appenders to write specifically to console.log inside log4j.properties, but I can not change using the wildfly console Log Categories the Log Level in runtime, and this is what I am trying to accomplish.

            • 3. Re: Using Log Categories in my Web App
              Wolf-Dieter Fink Master

              As I said you should delete your log4j configuration from the application and also remote log4j.jar from the lib folder of your deployment.

              If you add the logger, yes the catagory is the same as your getLogger(XX), you don't need to specify an appender, the root appender will be used.

              Notice that the CONSOLE suppress by default levels >INFO