web-applications - 如何在Weblogic中显示Java.Util Logger输出?

标签 web-applications weblogic java.util.logging

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.

  1. Use the Administration Console to manage log files and configure the following logging options:

    1. 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.

    2. Types of messages that the server sends to standard out. See "Specify messages for standard out" in the Oracle WebLogic Server Administration Console Help.

    3. 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.

    4. Log files for HTTP requests. See "Enable and configure HTTP logs" in the Oracle WebLogic Server Administration Console Help.

    5. Specify the logging implementation (Java Logging or Log4j). See How to Use Log4j with WebLogic Logging Services.

    6. 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.

  2. Alternatively, configure log message filtering on the message handler using the WebLogic Scripting Tool. See "Configuring Existing Domains" in Oracle WebLogic Scripting Tool.

  3. 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/

相关文章:

java - Commons 日志记录以使用 java.util.logging

javascript - 优化 iOS Web App 的音频

database-design - 你总是在 killer 级​​应用中使用的数据库表/字段

python - Django + GAE(谷歌应用引擎): most convenient path for a beginner?

java - 客户端和服务器之间不匹配 - Soap

java - ADF 皮肤样式加载错误的类

java - 无法找到 c3p0 日志消息

iphone - 无法选择表格单元格中的文本 (iPhone Mobile Safari)

java - 如何强制我的 EAR 文件仅部署在特定服务器上?

java - 日志记录级别未从属性文件加载