2 Replies Latest reply on Aug 1, 2013 3:02 PM by rdiddly

    Application logging in AS 7.1.1

    rdiddly

      I have just moved an EJB 2.1 app from JBoss 4.2.2 to EJB 3.1 and AS 7.1.1. I've got the application running in the container, and now would like to be able to see my log output. In 4.2.2 I used log4j, but it's not at all clear to me that this is still the way to go in 7.1.1. I've read a bit about JBoss' JUL implementation and am wondering if I should be using it. I can't find much information on how to modify my code to switch to a different implementation. What are the jar files to establish compile-time dependencies? What are the classes? Currently I create loggers in my class files using org.apache.log4j.Logger log = Logger.new(class.getName()) (that's pseudo-code, generally, each class uses its class name for the Logger instance). I've seen a bit about using CLI to configure logging, but I want some file, either in my own deployment, or in the server, that configures the logging system for my application.

       

      I'm sure I'm missing some wonderful piece of documentation that's out there. Can anyone point me in the right direction?

       

      Thanks.

       

      Richard

        • 1. Re: Application logging in AS 7.1.1
          wdfink

          You can use log4j in your application as your code shows. The only thing is to add a dependency to 'org.apache.log4j' to your manifest or jboss-structure.xml

           

          I prefer to use the CLI to add a logger for the application to the server configuration. All the logging will go into the server.log file in this case.

          • 2. Re: Application logging in AS 7.1.1
            rdiddly

            Thanks WDF, I can see it is logging, now that I've turned off show_sql in persistence.xml which was kind of drowning everything else out. I guess I'll have to look into using CLI. My problem with it is that there's no persistent artifact left over from the interaction with CLI, for documentation purposes. (Unless of course CLI will read its input from a file, which seems very likely, so, I'll have to go take a look.)