有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

AppEngina上的java Log4j>显示的所有日志消息都具有相同的日志级别

我的日志消息在app engine日志控制台中始终显示为“info”,即使我将消息记录为错误(参见屏幕截图)

我会记录这样的信息:

private static Logger logger = Logger.getLogger(PingServlet.class);
logger.error("Database was successfully pinged!!.");

配置如下:

src/main/resources/log4j。属性

# Root logger option
log4j.rootLogger=INFO, stdout

# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n

src/main/webapp/WEB-INF/logging。属性

# A default java.util.logging configuration.
# (All App Engine logging is through java.util.logging by default).
#
# To use this configuration, copy it into your application's WEB-INF
# folder and add the following to your appengine-web.xml:
# 
# <system-properties>
#   <property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
# </system-properties>
#

# Set the default logging level for all loggers to WARNING
.level = INFO

enter image description here

我该怎么改变呢?我想把一个错误显示为错误等等


共 (0) 个答案