How to initialize log4j properly?

前端 未结 24 3025
太阳男子
太阳男子 2020-11-22 06:49

After adding log4j to my application I get the following output every time I execute my application:

log4j:WARN No appenders could be found for logger (slideselec         


        
24条回答
  •  盖世英雄少女心
    2020-11-22 07:00

    You can set up the log level by using setLevel().

    The levels are useful to easily set the kind of informations you want the program to display.

    For example:

    Logger.getRootLogger().setLevel(Level.WARN); //will not show debug messages
    

    The set of possible levels are:

    TRACE,

    DEBUG,

    INFO,

    WARN,

    ERROR and

    FATAL

    According to Logging Services manual

提交回复
热议问题