Log4J creates log file but does not write to it

前端 未结 3 1213
执笔经年
执笔经年 2021-01-02 07:50

I\'m trying to configure log4j to log messages to a file. Right now, the file does get created with the name I provide, but the logs are not written to the file. My code:

3条回答
  •  臣服心动
    2021-01-02 08:21

    The output seems to be of the default format that Java's standard logging framework (JUL) would emit.

    So, there are two possibilities (that come to mind):

    1. Your code imports java.util.logging.Logger, rather than org.apache.log4j.Logger.
    2. There exists a library of some sort, in your classpath, that intercepts Log4J calls and converts them to JUL calls.

提交回复
热议问题