3 Replies Latest reply on Apr 15, 2016 11:19 AM by jamezp

    Logging subsystem configuration

    ravi21588

      Hi All,

      Iam using JBOSS Fuse service works 6.0.0 GA which runs in JBOSS EAP 6.1 container.

       

      I need to configure my logging subsystem in the way it can log the application related logs to a different file.

       

      I can configure the log files based upon the log levels,It include all the server errors and appplication errors.

       

      Can you tell me how can i configure the logging subsystem to print logs with log name eg BIHLog in to seperate log files.

       

      (ie.,)all the errors with BIHLog log name needs to be logged to a seperate file.

       

       

      14:44:38,017 ERROR [BIHLog] (Camel (camel-13) thread #33 - JmsConsumer[Q_Con_Send]) AyncConRQ - message received: <submitOrder >                        <order>                                 <orderId>100008</orderId>                       <itemId>BUTTER</itemId>                                 <qua

      ntity>200</quantity>                    </order> </submitOrder>

        • 1. Re: Logging subsystem configuration
          jamezp

          I'm assuming here BIHLog is the name of the logger (category). What you'd need to do is create a new handler and add a logger named BIHLog that uses the new handler.

           

          The following two CLI commands will add a new periodic-rotating-file-handler and all messages coming from a logger named BIHLog will be logged to this handler.

          /subsystem=logging/periodic-rotating-file-handler=BIHLog:add(append=true, autoflush=true, file={relative-to=jboss.server.log.dir, path=bih.log}, suffix=".yyyy-MM-dd")
          /subsystem=logging/logger=BIHLog:add(handlers=[BIHLog], use-parent-handlers=false, level=INFO)
          

           

          If you also want these logs to go to the server.log you can leave off the use-parent-handlers=false.

           

          --

          James R. Perkins

          1 of 1 people found this helpful
          • 2. Re: Logging subsystem configuration
            ravi21588

            Hi James,

            Thanks a lot it is working fine from apache camel when i use log component.

            Can you please tell me how to specify the logger name in java while using log4j.

            Iam not able to find any method to set log name.

            is the log4j logging and subsytem logging different?

            • 3. Re: Logging subsystem configuration
              jamezp

              Can you please tell me how to specify the logger name in java while using log4j.

              I'm not sure I understand what you mean by this.

               

              If you mean you want to define a logger in the logging subsystem the name would be the log4j category. That means what ever you used in Logger.getLogger("some.text"). If you used Logger.getLogger(com.example.Some.class) then the name would be "com.example.Some".

               

              Assuming you don't have a log4j configuration file in your deployment the logging subsystem should work fine with log4j.

               

              --

              James R. Perkins