3 Replies Latest reply on Sep 7, 2009 9:38 AM by mielket

    Log file per bundle instead of one global log file

    unwired

      Is it possible to have a log file per bundle ?  Currently we have an application that uses the log4j PropertyConfigurator.configure method to configure a different file at runtime.

       

      I am unable to get this to work with FUSE-ESB.  Is there some means of having many log files aside from  servicemix.log?

       

      Thanks

        • 1. Re: Log file per bundle instead of one global log file
          mielket

          I am not aware of a way to include a logging configuration into the bundle that would then write everything to a different log file.

          However since SMX4 logging is based on Log4J, one possible solution could be to use per package level appenders defined in the etc/org.ops4j.pax.logging.cfg. So something similar to

           

          log4j.logger.com.acme=DEBUG, XX
          log4j.appender.XX=org.apache.log4j.RollingFileAppender
          log4j.appender.XX.File=XX.log
          log4j.appender.XX.layout=org.apache.log4j.PatternLayout
          log4j.appender.XX.layout.ConversionPattern=%p %t %c - %m%n
          

           

          The same logging would still go to the loggers defined in root but you will also appear in the configured XX.log file.

           

          Not sure if that is sufficient for you.

          • 2. Re: Log file per bundle instead of one global log file
            unwired

            I was able to make the solution that you suggest work earlier but I am looking specifically for each bundle to have its own log4j.properties rather than having to edit the global file each time a new bundle is deployed.

             

            pax logging has a dummy PropertyConfigurator in their log4j facade.

             

            It would be a nice feature to have otherwise finding a log entry in a global file is quite painful.

            • 3. Re: Log file per bundle instead of one global log file
              mielket

              I raised ESB-862 to capture your request.