- PR -

2つのプロジェクトからlog4jでイベントログを出力する方法

1
投稿者投稿内容
まゆら
会議室デビュー日: 2006/04/20
投稿数: 4
投稿日時: 2006-05-30 13:40
まゆらと申します。

+++++++++++++++++++++++++
+++ 環境 ++++++++++++++++
+++++++++++++++++++++++++

・WindowsXP Professional SP2
・Java2SE SDK:1.4.2
・Tomcat   :5.0.28
・Eclipse  :2.1.3
・Struts   :1.2.4



Log4jを使用して、イベントログを出力しようと思っております。
プロジェクトが1つですとうまく出力されるのですが、
2つのプロジェクトから出力すると、下記のようなエラーが出てしまいます。
NTEventLogAppender.dllが既に読み込まれているのでエラーということだと思いますが、
これを何とか回避することはできないでしょうか?
どなたかご教授御願いいたします。



+++++++++++++++++++++++++
+++ commons-logging.properties ++++++++++
+++++++++++++++++++++++++

org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger



+++++++++++++++++++++++++
+++ log4j.properties ++++++++++
+++++++++++++++++++++++++
#Appender
log4j.rootCategory=INFO, EVENTLOG

# org.apacheから始まるパッケージはWARNレベル以上のみを出力
log4j.category.org.apache=WARN

#Appender EVENTLOG(イベントログ出力)
log4j.appender.EVENTLOG=org.apache.log4j.nt.NTEventLogAppender
 #ログを生成したアプリケーション名指定
 log4j.appender.EVENTLOG.Source=test1
 #出力書式
 log4j.appender.EVENTLOG.layout=org.apache.log4j.PatternLayout
 log4j.appender.EVENTLOG.layout.ConversionPattern=%m%n
 #出力レベル
 log4j.appender.EVENTLOG.Threshold=ERROR



+++++++++++++++++++++++++
+++ エラー内容 ++++++++++
+++++++++++++++++++++++++

2006/05/30 13:31:19 org.apache.catalina.startup.ContextConfig defaultConfig
致命的: デフォルトのweb.xml中の解析エラーです
org.apache.commons.logging.LogConfigurationException: java.lang.UnsatisfiedLinkError: Native Library C:\\WINDOWS\\SYSTEM32\\NTEventLogAppender.dll already loaded in another classloader (Caused by java.lang.UnsatisfiedLinkError: Native Library C:\\WINDOWS\\SYSTEM32\\NTEventLogAppender.dll already loaded in another classloader)
at org.apache.commons.digester.Digester.createSAXException(Digester.java:2540)
at org.apache.commons.digester.Digester.createSAXException(Digester.java:2566)
at org.apache.commons.digester.Digester.endElement(Digester.java:1061)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1548)
at org.apache.catalina.startup.ContextConfig.defaultConfig(ContextConfig.java:515)
at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:623)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:216)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4290)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
at org.apache.catalina.core.StandardService.start(StandardService.java:480)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)
at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)
2006/05/30 13:31:19 org.apache.catalina.startup.ContextConfig defaultConfig
致命的: 360行の46列目で発生しました
2006/05/30 13:31:19 org.apache.catalina.startup.ContextConfig applicationConfig
致命的: アプリケーションのweb.xml中の解析エラーです
org.apache.commons.logging.LogConfigurationException: java.lang.NoClassDefFoundError (Caused by java.lang.NoClassDefFoundError)
at org.apache.commons.digester.Digester.createSAXException(Digester.java:2540)
at org.apache.commons.digester.Digester.createSAXException(Digester.java:2566)
at org.apache.commons.digester.Digester.endElement(Digester.java:1061)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.endNamespaceScope(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1548)
at org.apache.catalina.startup.ContextConfig.applicationConfig(ContextConfig.java:263)
at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:624)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:216)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4290)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
at org.apache.catalina.core.StandardService.start(StandardService.java:480)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)
at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)
2006/05/30 13:31:19 org.apache.catalina.startup.ContextConfig applicationConfig
致命的: 100行の41列目で発生しました

1

スキルアップ/キャリアアップ(JOB@IT)