RE: Question about Log4j and ObjectRepositoryAssembler
"Christian Cryder" <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Message-ID | <[email protected]> |
Hi Jake, > Tomcat's logs? Which ones? The ones I'd expect to seem some logging in > (hint, not all of it is log4j logging): So I launch Tomcat (console mode) and the object repository logging (plus whatever logging gets triggered by things being assembled via the object repository) shows up here: localhost_log.2003-08-08.txt > Note that the following line is not part of Log4j logging: > Configuring GlobalOR from File: WEB-INF/object-repository.xml Yes, I understand that. The logging I am seeing is debug stuff from ObjectRepositoryAssembler. > Nope. Servlet context listeners are guaranteed to run before any servlet > runs. That is one of the main reasons why we moved away from the > Log4jInit servlet. It is a much better facility for application > pre-configuration in servlet-2.3+ than servlets are. Ok, so that's good to know. > Hmm..... you say log4j.properties? Not log4j.xml? Sorry, I meant log4j.xml. I don't think that's the issue, but I'll attach a copy of the one I use in Barracuda, just in case you find it helpful. > Are you saying this happens for Barracuda or one of your apps > using Barracuda libraries? Both. Just configure ObjectRepositoryAssembler logging to debug (like attached file), and restart Tomcat manually...you won't see any logging in the console, although subsequent log4j logging (once everything is up and running) DOES show in the console. This is the key point of my problem - initial obj repos logging goes to the log, but subsequent logging goes to the console as it should. That's what's so weird. > Alright, I just tested running Tomcat from the console. Same > result. Identical logging information from log4j goes to both > the console and the main.log Ok...but what I'm saying is that for me I _don't_ get the object repository logging going to the console when I run Tomcat directly, and I know I used to. What version of Tomcat are you using? I'm using Tomcat 4.1.12. Maybe that is part of the problem... ideas? Suggestions? tia, Christian > >---------------------------------------------- > >Christian Cryder > >Internet Architect, ATMReports.com > >Project Chair, BarracudaMVC - http://barracudamvc.org > >---------------------------------------------- > >"Coffee? I could quit anytime, just not today"
log4j.xml
(text/xml, 4.3 KB)
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false" threshold="debug">
<appender name="A1" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-4r [%t] %-5p %c %x - %m%n"/>
</layout>
</appender>
<appender name="A2" class="org.apache.log4j.FileAppender">
<param name="File" value="${Barracuda.log.home}/main.log" />
<param name="Append" value="false" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-4r [%t] %-5p %c %x - %m%n"/>
</layout>
</appender>
<!-- The Daily Rolling File Appender rolls over at midnight daily. All logging messages
are logged to this file. A new file is created in the format 'someName.yyyy-mm-dd.log'.
A maxiumum of 30 log files are kept. When that number exceeded, the oldest file is
deleted to make room for the newest file. The only parameter that should be modified
is the File value. -->
<appender name="A3" class="org.apache.log4j.DailyRollingFileAppenderExt">
<param name="DatePattern" value="'.'yyyy-MM-dd"/>
<param name="MaxLogs" value="30"/>
<param name="File" value="${Barracuda.log.home}/daily.log"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-15d{ABSOLUTE} %-10p (%c) - %m%n"/>
</layout>
</appender>
<!-- The SMTP Appender sends email messages. The threshold parameter should not be changed.
LTCG sends email o nERROR and FATAL errors only. Values must be provided for SMTPHost,
To, From, Subject, and BufferSize. To email each ERROR and FATAL error as it occurred, the
BufferSize parameter should be set to 1. The email will contain the time the FATAL error
occurred, the filename, the line number, and the custom error message. -->
<appender name="A4" class="org.apache.log4j.net.SMTPAppender">
<param name="Threshold" value="ERROR"/>
<param name="SMTPHost" value="999.99.9.9"/>
<param name="To" value="[email protected]"/>
<param name="From" value="[email protected]"/>
<param name="Subject" value="Log4j Error Message"/>
<param name="BufferSize" value="1"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ABSOLUTE} (%F:%L) - %m%n"/>
</layout>
</appender>
<appender name="JUnitAppender" class="org.apache.log4j.FileAppender">
<param name="File" value="${Barracuda.log.home}/test.log" />
<param name="Append" value="true" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-4r [%t] %-5p %c %x - %m%n"/>
</layout>
</appender>
<!-- Appenders for running JUnit tests -->
<!-- Using additivity="false" on the "test.org.enhydra.barracuda"
logger allows us to exclude the "root" logger levels and appenders
making this logger, essentially, the root for all test cases.
So, leave this logger alone. To add loggers so you can see logging
output for JUnit testcases, use the following syntax:
<logger name="test.org.enhydra.barracuda.core.forms">
<level value="debug"/>
</logger>
-->
<logger name="test.org.enhydra.barracuda" additivity="false"><level value="off"/><appender-ref ref="JUnitAppender"/></logger>
<!-- standard debuggers which should stay on -->
<logger name="org.enhydra.barracuda.plankton.Classes"><level value="warn"/><appender-ref ref="A1"/></logger>
<logger name="org.enhydra.barracuda.plankton.data.ObjectRepositoryAssembler"><level value="debug"/><appender-ref ref="A1"/></logger>
<!-- other debuggers (testing/debugging purposes) -->
<logger name="org.enhydra.barracuda.core.event.ApplicationGateway"><level value="warn"/><appender-ref ref="A1"/></logger>
<!-- Note: This root logger will be inherited by all loggers unless you use additivity="false". -->
<root>
<level value="warn"/>
<!--<appender-ref ref="A2"/>-->
<!--<appender-ref ref="A3"/>-->
<!--<appender-ref ref="A4"/>-->
</root>
</log4j:configuration>