weblogic91自定义http日志字段报错
本帖最后由 colourforU 于 2010-06-04 11:13:58 编辑 weblogic91使用扩展日志格式设置 HTTP 访问日志
登录console-Servers-AdminServer(admin)-Logging-选择http-Advanced-
其中Format 选择Extended
Extended Logging Format Fields : x-TrueIP date time cs-method cs-uri sc-status bytes cs(Referer) cs(User-Agent) cs(cookie)
其中x-TrueIP为自定义字段
class 如下:
import weblogic.servlet.logging.CustomELFLogger;
import weblogic.servlet.logging.FormatStringBuffer;
import weblogic.servlet.logging.HttpAccountingInfo;
public class TrueIP implements CustomELFLogger
{
//获取真实client ip
public void logField(HttpAccountingInfo metrics, FormatStringBuffer buff)
{
String ip = metrics.getHeader("X-Forwarded-For");
if(ip == null || ip.length() == 0) {
ip=metrics.getHeader("WL-Proxy-Client-IP");
}
if(ip == null || ip.length() == 0) {
ip=metrics.getRemoteAddr();
}
buff.appendValueOrDash(metrics.getHeader("ip"));
}
}
将TrueIP.class 增加到weblogic 的 setDomainEnv.sh 中
# SET THE CLASSPATH
CLASSPATH="${PRE_CLASSPATH}${CLASSPATHSEP}${WEBLOGIC_CLASSPATH}${CLASSPATHSEP}${POST_CLASSPATH}${CLASSPATHSEP}${WLP_POST_CLASSPATH}${CLASSPATHSEP}${WL_HOME}/integration/lib/util.jar::/home/weblogic/bea/user_projects/domains/base_domain/bin/TrueIP.class"
export CLASSPATH
重新启动weblogic nohup ./startWebLogic.sh >log&
报错信息如下:
WLS Start Mode=Development
.
CLASSPATH=:/home/weblogic/bea/patch_weblogic910/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/home/weblogic/bea/jdk150_04/lib/tools.jar:/home/weblogic/bea/weblogic91/server/lib/weblogic_sp.jar:/home/weblogic/bea/weblogic91/server/lib/weblogic.jar:/home/weblogic/bea/weblogic91/server/lib/webservices.jar::/home/weblogic/bea/weblogic91/common/eval/pointbase/lib/pbclient51.jar:/home/weblogic/bea/weblogic91/server/lib/xqrl.jar::/home/weblogic/bea/weblogic91/integration/lib/util.jar::/home/weblogic/bea/user_projects/domains/base_domain/bin/TrueIP.class:
.
PATH=/home/weblogic/bea/weblogic91/server/bin:/home/weblogic/bea/jdk150_04/jre/bin:/home/weblogic/bea/jdk150_04/bin:/usr/java/jdk1.5.0_11/bin:/usr/java/jdk1.5.0_11/bin:/usr/lib64/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
.
***************************************************
* To start WebLogic Server, use a username and *
* password assigned to an admin-level user. For *
* server administration, use the WebLogic Server *
* console at http://hostname:port/console *
***************************************************
starting weblogic with Java version:
java version "1.5.0_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode)
Starting WLS with line:
/home/weblogic/bea/jdk150_04/bin/java -client -Xms1024m -Xmx1024m -XX:CompileThreshold=8000 -XX:PermSize=48m -XX:MaxPermSize=128m -Xverify:none -da -Dplatform.home=/home/weblogic/bea/weblogic91 -Dwls.home=/home/weblogic/bea/weblogic91/server -Dwli.home=/home/weblogic/bea/weblogic91/integration -Dweblogic.management.discover=true -Dweblogic.ProductionModeEnabled= -Dwlw.iterativeDev= -Dwlw.testConsole= -Dwlw.logErrorsToConsole= -Dweblogic.ext.dirs=/home/weblogic/bea/patch_weblogic910/profiles/default/sysext_manifest_classpath -Dweblogic.Name=AdminServer -Djava.security.policy=/home/weblogic/bea/weblogic91/server/lib/weblogic.policy weblogic.Server
<2010-6-4 上午11时00分25秒 CST> <Info> <WebLogicServer> <BEA-000377> <Starting WebLogic Server with Java HotSpot(TM) Client VM Version 1.5.0_04-b05 from Sun Microsystems Inc.>
<2010-6-4 上午11时00分26秒 CST> <Info> <Management> <BEA-141107> <Version: WebLogic Server 9.1 Mon Dec 12 19:26:33 EST 2005 689178 >
<2010-6-4 上午11时00分28秒 CST> <Info> <WebLogicServer> <BEA-000215> <Loaded License : /home/weblogic/bea/license.bea>
<2010-6-4 上午11时00分28秒 CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING>
<2010-6-4 上午11时00分28秒 CST> <Info> <WorkManager> <BEA-002900> <Initializing self-tuning thread pool>
<2010-6-4 上午11时00分28秒 CST> <Notice> <Log Management> <BEA-170019> <The server log file /home/weblogic/bea/user_projects/domains/base_domain/servers/AdminServer/logs/AdminServer.log is opened. All server side log events will be written to this file.>
<2010-6-4 上午11时00分28秒 CST> <Error> <Socket> <BEA-000438> <Unable to load performance pack. Using Java I/O instead. Please ensure that libmuxer library is in :'/home/weblogic/bea/jdk150_04/jre/lib/i386/client:/home/weblogic/bea/jdk150_04/jre/lib/i386:/home/weblogic/bea/jdk150_04/jre/../lib/i386:/home/weblogic/bea/patch_weblogic910/profiles/default/native:/home/weblogic/bea/weblogic91/server/native/linux/x86_64:/home/weblogic/bea/weblogic91/server/native/linux/x86_64/oci920_8'
>
<2010-6-4 上午11时00分29秒 CST> <Notice> <Security> <BEA-090082> <Security initializing using security realm myrealm.>
<2010-6-4 上午11时00分31秒 CST> <Error> <HTTP> <BEA-101231> <HTTP log file does not use version 1.0 of the Extended Log File format.>
<2010-6-4 上午11时00分31秒 CST> <Error> <HTTP> <BEA-101234> <Attempting to initialize ExtendedLogFormat application specific header: x-TrueIP. However, failed due to exception.>
<2010-6-4 上午11时00分31秒 CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STANDBY>
<2010-6-4 上午11时00分31秒 CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING>
参考文档:http://edocs.weblogicfans.net/wls/docs92/config_wls/web_server.html#wp1059475
[解决办法]
顶顶顶
[解决办法]
谁来解决一下!!!
[解决办法]
<2010-6-4 上午11时00分31秒 CST> <Error> <HTTP> <BEA-101231> <HTTP log file does not use version 1.0 of the Extended Log File format.>
Error: HTTP log file does not use version 1.0 of the Extended Log File format.
Description
HTTP log file does not use version 1.0 of the Extended Log File format.
Cause
The ELF headers in the existing log file specifies a version other than 1.0.
Action
Only version 1.0 is supported. Delete the existing log file and startover again.
[解决办法]
问题已经解决了 就是设置classpath的问题,只要设置MyCustomField.class文件所在的目录就可以了,我之前设置的是目录+类名,所以启动报错。
[解决办法]
我配置了classpath似乎没有作用啊,帮忙看看,谢啦
CLASSPATH="${PRE_CLASSPATH}${CLASSPATHSEP}${WEBLOGIC_CLASSPATH}${CLASSPATHSEP}${POST_CLASSPATH}${CLASSPATHSEP}${WLP_POST_CLASSPATH}${WL_HOME}/integration/lib/util.jar::/home/weblogic/bea/user_projects/domains/compare/bin/"