2 Replies Latest reply on Feb 20, 2004 8:51 AM by milowe

    Is it *really* possible to use Log4j ?

    juliof

      Hi !
      Am am trying to use Log4j with JBoss, with 2 restrictions :
      - I want my code to be not app-server specific ( using the apache log4j lib ).
      - I want to have the configuration files inside my app, no in server config.

      Is this possible to do ? I am having a really hard time configuring jboss and log4j. Can anyone give any hint ?

        • 1. Re: Is it *really* possible to use Log4j ?
          mikefinn

          #1 is fairly simple. As long as you have a way to set log4j.configuration as a system property, you should be able to use log4j from anywhere, portably. Of course, each server has it's idiosyncracies as to how it uses log4j (categories, trace-level extensions, etc). You may want to look at jakarta-commons-logging. It's basically a veneer on top of different logging implementations. You may never have total portability, since it's not part of j2ee spec.

          #2 is a different story. Many have asked about application-level log4j configs, a few have claimed they have done it, but I have yet to see anyone offer a working example.

          • 2. Re: Is it *really* possible to use Log4j ?
            milowe

            You can have your config files in your app or elsewhere. Just setup log4j in your app using your config file.

            org.apache.log4j.xml.DOMConfigurator.configureAndWatch()