简体   繁体   中英

slf4j logger Info level not logging in Apache Tomcat

I have class with functions and I use slf4j logger in them. When testing those functions without server, logger works as configured in log4j.xml file. The level of logging is "info" by default. So, with the following code I get this output:

    logger.error("get tree of id = " + id);
    logger.warn("get tree of id = " + id);
    logger.info("get tree of id = " + id);
    logger.debug("get tree of id = " + id);
    logger.trace("get tree of id = " + id);

Output:

    ERROR: com.app.models.DatabaseModel - get tree of id = 1470
    WARN : com.app.models.DatabaseModel - get tree of id = 1470
    INFO : com.app.models.DatabaseModel - get tree of id = 1470

But when I run Tomcat Server, the output is different from the same code:

    ERROR: com.app.models.DatabaseModel - get tree of id = 1470
    WARN : com.app.models.DatabaseModel - get tree of id = 1470

What is the problem here? How to configure slf4j to work on server the same way as given in configuration file?

With the help of mad_fox I figured out that I had multiple log4j.xml files in my directories and I was configuring the wrong one. Solved

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM