Logger 用于内部 jar,我在一些 Weblogic 文档中看到可以查看 Log4j 记录器输出。
如何查看导入java.util.logging.Logger输出?
我做了http://docs.oracle.com/cd/E21764_01/web.1111/e13739/logging_services.htm#WLLOG199中提到的事情
我创建了 logger.properties 并运行 -Djava 命令,但仍然无法查看 Logger 日志。
# Specify the handlers to create in the root logger
handlers = weblogic.logging.ServerLoggingHandler
# Register handlers for the com.foo.toyshop and its child loggers
com.foo.toyshop.handlers = java.util.logging.ConsoleHandler, weblogic.logging.ServerLoggingHandler
# Do not send the toyshop log messages to the root handler
com.foo.toyshop.useParentHandlers = false
# Set the default logging level for the root logger
.level = ALL
# Set the default logging level for new ConsoleHandler instances
java.util.logging.ConsoleHandler.level = INFO
# Set the default logging level for new FileHandler instances
weblogic.logging.ServerLoggingHandler.level = ALL
[更新]
出于某种原因,我只能在 WL 进程打印 (./startWL.sh) 中看到 Logger 输出,而在日志中看不到
最佳答案
如果您使用 Log4j 或 Commons Logging,Weblogic 两者都支持,解释如下:Log4j and the Commons Logging API
同样guide您可以找到使用日志记录和 Weblogic 所需的步骤:
The following steps summarize how you configure and filter log messages that WebLogic Server generates. Related documentation and later sections in this guide describe these steps in more detail.
Use the Administration Console to manage log files and configure the following logging options:
Domain and server log file name and location, rotation pattern, location of archived log files, and number of log files stored. See "View and configure logs" in the Oracle WebLogic Server Administration Console Help.
Types of messages that the server sends to standard out. See "Specify messages for standard out" in the Oracle WebLogic Server Administration Console Help.
Which messages a server instance sends to the domain log. See "Forward messages to the domain log" in the Oracle WebLogic Server Administration Console Help.
Log files for HTTP requests. See "Enable and configure HTTP logs" in the Oracle WebLogic Server Administration Console Help.
Specify the logging implementation (Java Logging or Log4j). See How to Use Log4j with WebLogic Logging Services.
Specify message destination and configure filtering log messages by severity level or other criteria. See "Filter log messages" in the Oracle WebLogic Server Administration Console Help. See also Specifying Severity Level for Loggers.
Alternatively, configure log message filtering on the message handler using the WebLogic Scripting Tool. See "Configuring Existing Domains" in Oracle WebLogic Scripting Tool.
Filter log messages published by the logger using the Java APIs. See Filtering Messages by Severity Level or Other Criteria.
关于web-applications - 如何在Weblogic中显示Java.Util Logger输出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28026183/