7 Replies Latest reply on Mar 15, 2010 7:33 AM by borobudur

    Exclude stdout from certain Lib

      We are using alibrary which has some System.out.println("bla-bla") which we don't want to see on the console and in the log-file.

      Is there a way how to exclude this libs output?

       

      Lets say the lib is called org.mylib

      I tried in jboss-log4j.xml with:

         <category name="org.mylib" additivity="false">
            <priority value="WARN"/>
           <appender-ref ref="CONSOLE"/>
         </category>

        • 1. Re: Exclude stdout from certain Lib
          peterj

          Try this:

           

            <category name="STDOUT" additivity="false">
                 <priority value="WARN"/>
               <appender-ref  ref="CONSOLE"/>
             </category>

           

          The category name is usually printed within braces, [...], in the JBoss AS log file and System.out text shows as:

           

          2010-03-08 09:04:57,618 INFO  [STDOUT] (Thread-18) Retrieving document at ...

          • 2. Re: Exclude stdout from certain Lib

            Better would be just to exclude this library but it's already a solution. Thanks!

             

            Can I ask you an othere thing I'm trying to do but can't really find a good solution?

             

            I would like to develop in debug mode but if I change to debug all the jboss debug output is shown too and the server is this slow that it doesn't really run anymore. How can I set the global to info mode and my application to debug? Thanks again!

            • 3. Re: Exclude stdout from certain Lib
              jaikiran
              You want your application's DEBUG level logs to appear on the CONSOLE? Or do you want them to be available in a log file?
              • 4. Re: Exclude stdout from certain Lib
                Console
                • 5. Re: Exclude stdout from certain Lib
                  jaikiran

                  Try this:

                   

                  <!-- Set the threshold of CONSOLE appender to DEBUG -->
                  <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
                        ...
                        <param name="Threshold" value="DEBUG"/>
                  
                        ...
                     </appender>
                     
                     <!-- Set the log level of your app's loggers to DEBUG -->
                     <category name="org.myapp">
                         <priority value="DEBUG"/>
                     </category>
                     
                     
                     <!-- And set the log level of the root logger to INFO -->
                     <root>
                        
                        <priority value="INFO"/>
                        <appender-ref ref="CONSOLE"/>
                        <appender-ref ref="FILE"/>
                     </root>
                  
                  
                  • 6. Re: Exclude stdout from certain Lib
                    That works, thanks!
                    • 7. Re: Exclude stdout from certain Lib
                      I didn't find the concept of jboss/log4j threshold/appender to easy to understand. I made a little drawing. Perhaps it helps someone else.