logging - Weblogic日志定制

标签 logging weblogic customization weblogic-10.x weblogic11g

我有一个 weblogic 服务器 (10.3.5)。 我已经配置了一个新的logger/log_handler,没问题。

我现在想更改此 log_handler 上日志的写入方式。 目前,它是这样写的:

[2013-07-29T09:41:16.653+00:00] [MS_server1] [NOTIFICATION] [] [myCustomLogger] [tid: [ACTIVE].ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: Anonymous] [ecid: 3928459900541890,0:1:1:1] [APP: myfrontend-1] [URI: /FO/app/pages/feedback] My loggued message.

我需要删除 weblogic 自动添加到最终得到的所有部分:

My loggued message.

我的 logging.xml 包含:

<log_handler name='myCustomLLog-handler' class='oracle.core.ojdl.logging.ODLHandlerFactory' filter='oracle.dfw.incident.IncidentDetectionLogFilter'>
   <property name='path' value='${domain.home}/servers/${weblogic.Name}/logs/${weblogic.Name}-myCustomLog.log'/>
   <property name='maxFileSize' value='10485760'/>
   <property name='maxLogSize' value='104857600'/>
   <property name='encoding' value='UTF-8'/>
   <property name='useThreadName' value='true'/>
   <property name='supplementalAttributes' value='J2EE_APP.name,J2EE_MODULE.name,WEBSERVICE.name,WEBSERVICE_PORT.name,composite_instance_id,component_instance_id,composite_name,component_name'/>
</log_handler>

我怎样才能做到这一点?

谢谢!

最佳答案

我向 Oracle 团队提出了同样的问题,他们说这是不可能的,除非使用 log4j 记录器。

引用 BeeAarKay 的话:

To my knowledge, you can't change WebLogic Server's own Log Message Format (any ways the support requires informations in case of a problem).

But you can configure WebLogic to use Log4j (please review the URL :: http://docs.oracle.com/cd/E13222_01/wls/docs103/logging/config_logs.html#wp1014610 for "How to Use Log4j with WebLogic Logging Services") and, when Log4j is enabled, you can get a reference to the org.apache.log4j.Logger that the server is using and attach your own appender.

When Log4j is enabled, you get a reference to the org.apache.log4j.Logger that the server is using from the weblogic.logging.log4j.Log4jLoggingHelper class.

With a Log4j Logger reference, `you can attach you own custom appender to receive the server log events; for example, you might attach an appender that sends the server log events to Syslog or the Windows Event Viewer. Additionally, you can use the Logger reference to issue log requests to WebLogic logging services; this requires that the Log4j libraries be available to your deployed application.

But this is not a replacement of WebLogic's own log.

关于logging - Weblogic日志定制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17923150/

相关文章:

Python-需要将控制台输出重定向到日志文件

java - 如何在 PLAY Java 日志中显示 CLASSNAME?

java - 使用 ANTLR 解析日志文件

android - 如何在构建源代码之前在 android 中创建自定义启动屏幕?

c - 用自定义条件包装 printf

iis - 用于 IIS Web 服务器日志的日志分析器工具

java - 在 WebLogic 11g 中使用远程 EJB 时出现 ClassNotFoundException

ejb - 如何在WebLogic中设置虚拟主机?

jboss - 是否可以对 ATG 类进行热交换