Problems with wiki Logging examples 3.2.3/3.2.5
jardia Jul 21, 2004 7:25 AMHello.
I've been trying the webapp/logging examples on the wiki (http://www.jboss.org/wiki/Wiki.jsp?page=Logging) and have been running into problems/unexpected results.
Questions:
These questions refer to the steps outlined below.
Q1) In step B3 why is there no log file?
Q2) What do the error in step C2 mean? Is there a problem with the log4j.properties?
Q3) What extra logging info would be appropriate here? web/logging/everything?
Q4) General question: Has anyone seen a scenario where a deployed application disables all of jboss logging (console and server.log)?
Here are the steps i worked through:
-source: http://www.jboss.org/wiki/attach?page=Logging%2Flog4j.war.zip
-jdk: Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_03-b02)
-os: windows 2000
-jboss: clean installs of 3.2.3 and 3.2.5
A - JBoss example on 3.2.3
1. Deploy
12:30:08,828 INFO [EmbeddedTomcatService] deploy, ctxPath=/log4j, warUrl=file:/D:/temp/loggingtests/jboss-3.2.3/server/default/deploy/log4j.war/ 12:30:09,171 INFO [Engine] SingleSignOnContextConfig[/log4j]: Added certificates -> request attribute Valve 12:30:09,187 WARN [EmbeddedTomcatService] Unable to invoke setDelegate on class loader:org.jboss.web.tomcat.tc4.WebCtxLoader$ENCLoader@ea7549 12:30:09,187 INFO [Engine] StandardManager[/log4j]: Seeding random number generator class java.security.SecureRandom 12:30:09,187 INFO [Engine] StandardManager[/log4j]: Seeding of random number generator has been completed 12:30:09,203 INFO [Engine] StandardWrapper[/log4j:default]: Loading container servlet default 12:30:09,203 INFO [Engine] StandardWrapper[/log4j:invoker]: Loading container servlet invoker 12:30:09,421 INFO [MainDeployer] Deployed package: file:/D:/temp/loggingtests/jboss-3.2.3/server/default/deploy/log4j.war/
2. Hit test page http://localhost:8080/log4j/snoop.jsp
12:31:28,765 INFO [STDOUT] log4j: Threshold ="null". 12:31:28,781 INFO [STDOUT] log4j: Class name: [org.apache.log4j.FileAppender] 12:31:28,796 INFO [STDOUT] log4j: Setting property [file] to [D:\temp\loggingtests\jboss-3.2.3\server\default/log/log4j-test.log]. 12:31:28,796 INFO [STDOUT] log4j: Setting property [append] to [false]. 12:31:28,796 INFO [STDOUT] log4j: Parsing layout of class: "org.apache.log4j.PatternLayout" 12:31:28,843 INFO [STDOUT] log4j: Setting property [conversionPattern] to [%d %-5p [%c] %m%n]. 12:31:28,843 INFO [STDOUT] log4j: setFile called: D:\temp\loggingtests\jboss-3.2.3\server\default/log/log4j-test.log, false 12:31:28,843 INFO [STDOUT] log4j: setFile ended 12:31:28,843 INFO [STDOUT] log4j: Adding appender named [FILE] to category [root].
3. server/default/log/log4j-test.log contents
2004-07-21 12:31:28,843 INFO [SnoopPage] Enter jspInit 2004-07-21 12:31:28,890 INFO [SnoopPage] SessionID: 2CD928DF4A83299E170D524569FA1441, AccessCount: 1
4. shutdown and remove deploy/log4j.war
B - JBoss example on 3.2.5
1. Deploy
12:34:04,484 INFO [TomcatDeployer] deploy, ctxPath=/log4j, warUrl=file:/D:/temp/loggingtests/jboss-3.2.5/server/default/deploy/log4j.war/
2. Hit test page http://localhost:8080/log4j/snoop.jsp
12:34:53,296 INFO [SnoopPage] Enter jspInit 12:34:53,328 INFO [SnoopPage] SessionID: F199907ADCAE00E21791852639FB0DBF, AccessCount: 1
3. server/default/log/log4j-test.log contents
File does NOT EXIST!
4. shutdown and remove deploy/log4j.war
I then tried a modified version of the JBoss example.
JBoss example modifications
-renamed conf/log4j.xml to conf/jbosslog4j.xml
-edit 'ConfigurationURL' value in conf/jboss-service.xml to resource:jbosslog4j.xml
-in example webapp (log4j.war) replace classes/log4j.xml with classes log4j.properties
log4j.debug=true log4j.rootLogger=FILE # A time/date based rolling appender log4j.appender.FILE=org.apache.log4j.FileAppender log4j.appender.FILE.File=${jboss.server.home.dir}/log/log4j-test2.log log4j.appender.FILE.append=false log4j.appender.FILE.layout=org.apache.log4j.PatternLayout log4j.appender.FILE.layout.ConversionPattern = %d %-5p [%c] %m%n
C - JBoss modified example on 3.2.3
1. Deploy
12:48:59,250 INFO [EmbeddedTomcatService] deploy, ctxPath=/log4j, warUrl=file:/D:/temp/loggingtests/jboss-3.2.3/server/default/deploy/log4j.war/ 12:48:59,546 INFO [Engine] SingleSignOnContextConfig[/log4j]: Added certificates -> request attribute Valve 12:48:59,578 WARN [EmbeddedTomcatService] Unable to invoke setDelegate on class loader:org.jboss.web.tomcat.tc4.WebCtxLoader$ENCLoader@1532fc 12:48:59,578 INFO [Engine] StandardManager[/log4j]: Seeding random number generator class java.security.SecureRandom 12:48:59,578 INFO [Engine] StandardManager[/log4j]: Seeding of random number generator has been completed 12:48:59,578 INFO [Engine] StandardWrapper[/log4j:default]: Loading container servlet default 12:48:59,578 INFO [Engine] StandardWrapper[/log4j:invoker]: Loading container servlet invoker 12:48:59,812 INFO [MainDeployer] Deployed package: file:/D:/temp/loggingtests/jboss-3.2.3/server/default/deploy/log4j.war/
2. Hit test page http://localhost:8080/log4j/snoop.jsp
12:49:55,765 ERROR [STDERR] log4j:ERROR A "org.jboss.logging.appender.FileAppender" object is not assignable to a "org.apache.log4j.Appender" variable. 12:49:55,765 ERROR [STDERR] log4j:ERROR The class "org.apache.log4j.Appender" was loaded by 12:49:55,765 ERROR [STDERR] log4j:ERROR [org.jboss.mx.loading.UnifiedClassLoader3@f70ee1{ url=file:/D:/temp/loggingtests/jboss-3.2.3/server/default/deploy/log4j.war/ ,addedOrder=35}] whereas object of type 12:49:55,765 ERROR [STDERR] log4j:ERROR "org.jboss.logging.appender.FileAppender" was loaded by [org.jboss.system.server.NoAnnotationURLClassLoader@c3c749]. 12:49:55,765 ERROR [STDERR] log4j:ERROR Could not instantiate appender named "FILE". 12:49:55,859 INFO [STDOUT] 12:49:55,859 INFO [SnoopPage] Enter jspInit 12:49:55,890 INFO [STDOUT] 12:49:55,890 INFO [SnoopPage] SessionID: A200C007F06205A195B9C4D5D28838BD, AccessCount: 1
3. server/default/log/log4j-test2.log contents
File does NOT EXIST! Could not creat appender
4. shutdown and remove deploy/log4j.war
D - JBoss modified example on 3.2.5
1. Deploy
12:54:50,828 INFO [TomcatDeployer] deploy, ctxPath=/log4j, warUrl=file:/D:/temp/loggingtests/jboss-3.2.5/server/default/deploy/log4j.war/
2. Hit test page http://localhost:8080/log4j/snoop.jsp
12:55:10,390 INFO [SnoopPage] Enter jspInit 12:55:10,421 INFO [SnoopPage] SessionID: 9DF81C2ED821EAEE63800FFFD6868375, AccessCount: 1
3. server/default/log/log4j-test2.log contents
File does NOT EXIST!
4. shutdown and remove deploy/log4j.war