How to not print specific logs? [duplicate]












0
















This question already has an answer here:




  • Disable the log from specific class/jar via logback.xml

    2 answers




My question can seem quite strange but I wanted to configure my logback.xml to stop printing certain logs.



For instance, my console is polluted by a so called ERROR because a key value in a property file is duplicated. I'm aware of this problem but it's not impacting in any sorts the process. But in this case I have so many of them that I can't look at the actual logs.



I've been told to add an appender in the logback file to change the level of logs from the class and thus not printing ERROR level logs. But I don't really know how to do it.



Here is the log



14/11/2018_15:02:19.654 [main] ERROR [f.a.t.core.resources.ResourceManager] duplicated key in resources :



it's just ERROR level log from this class "f.a.t.core.resources.ResourceManager" that I don't want. Does anyone have faced a similar issue please ?










share|improve this question













marked as duplicate by Community Nov 14 '18 at 15:21


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.




















    0
















    This question already has an answer here:




    • Disable the log from specific class/jar via logback.xml

      2 answers




    My question can seem quite strange but I wanted to configure my logback.xml to stop printing certain logs.



    For instance, my console is polluted by a so called ERROR because a key value in a property file is duplicated. I'm aware of this problem but it's not impacting in any sorts the process. But in this case I have so many of them that I can't look at the actual logs.



    I've been told to add an appender in the logback file to change the level of logs from the class and thus not printing ERROR level logs. But I don't really know how to do it.



    Here is the log



    14/11/2018_15:02:19.654 [main] ERROR [f.a.t.core.resources.ResourceManager] duplicated key in resources :



    it's just ERROR level log from this class "f.a.t.core.resources.ResourceManager" that I don't want. Does anyone have faced a similar issue please ?










    share|improve this question













    marked as duplicate by Community Nov 14 '18 at 15:21


    This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


















      0












      0








      0


      0







      This question already has an answer here:




      • Disable the log from specific class/jar via logback.xml

        2 answers




      My question can seem quite strange but I wanted to configure my logback.xml to stop printing certain logs.



      For instance, my console is polluted by a so called ERROR because a key value in a property file is duplicated. I'm aware of this problem but it's not impacting in any sorts the process. But in this case I have so many of them that I can't look at the actual logs.



      I've been told to add an appender in the logback file to change the level of logs from the class and thus not printing ERROR level logs. But I don't really know how to do it.



      Here is the log



      14/11/2018_15:02:19.654 [main] ERROR [f.a.t.core.resources.ResourceManager] duplicated key in resources :



      it's just ERROR level log from this class "f.a.t.core.resources.ResourceManager" that I don't want. Does anyone have faced a similar issue please ?










      share|improve this question















      This question already has an answer here:




      • Disable the log from specific class/jar via logback.xml

        2 answers




      My question can seem quite strange but I wanted to configure my logback.xml to stop printing certain logs.



      For instance, my console is polluted by a so called ERROR because a key value in a property file is duplicated. I'm aware of this problem but it's not impacting in any sorts the process. But in this case I have so many of them that I can't look at the actual logs.



      I've been told to add an appender in the logback file to change the level of logs from the class and thus not printing ERROR level logs. But I don't really know how to do it.



      Here is the log



      14/11/2018_15:02:19.654 [main] ERROR [f.a.t.core.resources.ResourceManager] duplicated key in resources :



      it's just ERROR level log from this class "f.a.t.core.resources.ResourceManager" that I don't want. Does anyone have faced a similar issue please ?





      This question already has an answer here:




      • Disable the log from specific class/jar via logback.xml

        2 answers








      java logging






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 14 '18 at 14:17









      Aaron C.Aaron C.

      33




      33




      marked as duplicate by Community Nov 14 '18 at 15:21


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






      marked as duplicate by Community Nov 14 '18 at 15:21


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


























          1 Answer
          1






          active

          oldest

          votes


















          0














          Specify in your logback xml conf file the class that you want disable logs.

          For example :



          <logger name="fullpackage.ResourceManager" level="OFF" />


          But note that is not a good practice because you will lose all potential useful error logs for this class.

          The best thing would be to refactor this class (if you can) and decrease the level to INFO or below.






          share|improve this answer
























          • Thank you, I though it was not BP but this class is from an external library I imported so I don't have access to its source code.

            – Aaron C.
            Nov 14 '18 at 14:39











          • Thank you again David, I wanted to know if it was possible to be even more specific with that logger, can we specify just a type of error? For instance if I want the logs from that class but not those which contains the words "duplicated key" or is it not possible ?

            – Aaron C.
            Nov 14 '18 at 15:24











          • You are welcome. Of course you could use Logback filters by specifying the message to filter out

            – davidxxx
            Nov 14 '18 at 18:44


















          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Specify in your logback xml conf file the class that you want disable logs.

          For example :



          <logger name="fullpackage.ResourceManager" level="OFF" />


          But note that is not a good practice because you will lose all potential useful error logs for this class.

          The best thing would be to refactor this class (if you can) and decrease the level to INFO or below.






          share|improve this answer
























          • Thank you, I though it was not BP but this class is from an external library I imported so I don't have access to its source code.

            – Aaron C.
            Nov 14 '18 at 14:39











          • Thank you again David, I wanted to know if it was possible to be even more specific with that logger, can we specify just a type of error? For instance if I want the logs from that class but not those which contains the words "duplicated key" or is it not possible ?

            – Aaron C.
            Nov 14 '18 at 15:24











          • You are welcome. Of course you could use Logback filters by specifying the message to filter out

            – davidxxx
            Nov 14 '18 at 18:44
















          0














          Specify in your logback xml conf file the class that you want disable logs.

          For example :



          <logger name="fullpackage.ResourceManager" level="OFF" />


          But note that is not a good practice because you will lose all potential useful error logs for this class.

          The best thing would be to refactor this class (if you can) and decrease the level to INFO or below.






          share|improve this answer
























          • Thank you, I though it was not BP but this class is from an external library I imported so I don't have access to its source code.

            – Aaron C.
            Nov 14 '18 at 14:39











          • Thank you again David, I wanted to know if it was possible to be even more specific with that logger, can we specify just a type of error? For instance if I want the logs from that class but not those which contains the words "duplicated key" or is it not possible ?

            – Aaron C.
            Nov 14 '18 at 15:24











          • You are welcome. Of course you could use Logback filters by specifying the message to filter out

            – davidxxx
            Nov 14 '18 at 18:44














          0












          0








          0







          Specify in your logback xml conf file the class that you want disable logs.

          For example :



          <logger name="fullpackage.ResourceManager" level="OFF" />


          But note that is not a good practice because you will lose all potential useful error logs for this class.

          The best thing would be to refactor this class (if you can) and decrease the level to INFO or below.






          share|improve this answer













          Specify in your logback xml conf file the class that you want disable logs.

          For example :



          <logger name="fullpackage.ResourceManager" level="OFF" />


          But note that is not a good practice because you will lose all potential useful error logs for this class.

          The best thing would be to refactor this class (if you can) and decrease the level to INFO or below.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 14 '18 at 14:23









          davidxxxdavidxxx

          64.8k66194




          64.8k66194













          • Thank you, I though it was not BP but this class is from an external library I imported so I don't have access to its source code.

            – Aaron C.
            Nov 14 '18 at 14:39











          • Thank you again David, I wanted to know if it was possible to be even more specific with that logger, can we specify just a type of error? For instance if I want the logs from that class but not those which contains the words "duplicated key" or is it not possible ?

            – Aaron C.
            Nov 14 '18 at 15:24











          • You are welcome. Of course you could use Logback filters by specifying the message to filter out

            – davidxxx
            Nov 14 '18 at 18:44



















          • Thank you, I though it was not BP but this class is from an external library I imported so I don't have access to its source code.

            – Aaron C.
            Nov 14 '18 at 14:39











          • Thank you again David, I wanted to know if it was possible to be even more specific with that logger, can we specify just a type of error? For instance if I want the logs from that class but not those which contains the words "duplicated key" or is it not possible ?

            – Aaron C.
            Nov 14 '18 at 15:24











          • You are welcome. Of course you could use Logback filters by specifying the message to filter out

            – davidxxx
            Nov 14 '18 at 18:44

















          Thank you, I though it was not BP but this class is from an external library I imported so I don't have access to its source code.

          – Aaron C.
          Nov 14 '18 at 14:39





          Thank you, I though it was not BP but this class is from an external library I imported so I don't have access to its source code.

          – Aaron C.
          Nov 14 '18 at 14:39













          Thank you again David, I wanted to know if it was possible to be even more specific with that logger, can we specify just a type of error? For instance if I want the logs from that class but not those which contains the words "duplicated key" or is it not possible ?

          – Aaron C.
          Nov 14 '18 at 15:24





          Thank you again David, I wanted to know if it was possible to be even more specific with that logger, can we specify just a type of error? For instance if I want the logs from that class but not those which contains the words "duplicated key" or is it not possible ?

          – Aaron C.
          Nov 14 '18 at 15:24













          You are welcome. Of course you could use Logback filters by specifying the message to filter out

          – davidxxx
          Nov 14 '18 at 18:44





          You are welcome. Of course you could use Logback filters by specifying the message to filter out

          – davidxxx
          Nov 14 '18 at 18:44



          這個網誌中的熱門文章

          Xamarin.form Move up view when keyboard appear

          Post-Redirect-Get with Spring WebFlux and Thymeleaf

          Anylogic : not able to use stopDelay()