Re: Question about Log4j and ObjectRepositoryAssembler
Jacob Kjome <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Message-ID | <[email protected]> |
Hi Christian,
At 05:08 PM 8/7/2003 -0600, you wrote:
>Hey Jake,
>
>Here's a question for you about Log4j and ObjectRepositoryAssembler.
>Basically, everything seems to be working fine for the most part in regards
>to logging - I am running Tomcat directly (not as a service), and calls to
>various loggers show up in the Tomcat console, which is where I expect to be
>seeing them.
>
>The issue is that I cannot get the logging for ObjectRepositoryAssembler to
>show up in the console, and I know it used to. What is happening, is that
>ObjectRepositoryAssembler logging is going to the log files in Tomcat's logs
>directories.
Tomcat's logs? Which ones? The ones I'd expect to seem some logging in
(hint, not all of it is log4j logging):
localhost_Barracuda_servlet_log.2003-08-07.txt
and
stdout.log (if running as a service and specifying the stdout.log as the
standard out file which is where the console logger will write to)
Note that the following line is not part of Log4j logging:
Configuring GlobalOR from File: WEB-INF/object-repository.xml
That comes from lines 316 through 321...
if (is!=null) {
String logString = "Configuring "+ior.getName()+" from
File: "+iassemblySourceFile;
if (iservletConfig != null)
iservletConfig.getServletContext().log(logString);
if (logHeartbeat) System.out.println(logString);
if (logger.isDebugEnabled()) logger.debug(logString);
}
See how we write to the servlet logging facility and the System.out
facility. There log4j logging, but since it is "debug", you don't see it
because the level is set to "info".
Now, also note that there actually are some logger.info() statements
written *before* line mentioned above is written.
>What I _suspect_ happened is that the problem began when we went away from
>using the Log4j init servlet - in web.xml, that used to be forced to run
>before the ObjectRepositoryAssembler. Now, when we switched to the Log4j
>context listener, I am _guessing_ that the ObjectRepositoryAssembler servlet
>is no longer waiting for the Log4j stuff before it runs
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.
>...so if the log4j
>config stuff is not configured, then that would explain why my logging is
>initially going to the default log file, and then subseqent logging goes
>where its supposed to according to what's defined in my log4j.properties.
Hmm..... you say log4j.properties? Not log4j.xml? If you are using the
logging set up in Barracuda where it is set up to configure stuff from
log4j.xml in the WEB-INF directory and then you have log4j.properties in
WEB-INF/classes, then you might be re-configuring everything. If log4j
finds log4j.properties in your classpath it might do default configuration
(although I thought default configuration was not perfomed by log4j if it
was already done before that?). I'm a bit confused by your setup. Are you
saying this happens for Barracuda or one of your apps using Barracuda
libraries?
>At any rate, that's my theory, and I'd like to get your opinion on it. Its
>easy to test - just run Tomcat directly and see if you can get
>ObjectRepositoryAssembler logging to show up in the console.
Ok, if all I have to do is test Barracuda itself, then I can tell you,
everything is working just fine for me, although I run things as a
service. The logging output going to Tomcat's stdout.log (console
appender) and that going to the Barracuda log4j configured main.log are
identical except for the extra "Configuring GlobalOR from File:
WEB-INF/object-repository.xml" in stdout.log, but that is from the
System.out.println() statement.
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 (besides the obvious System.out stuff mentioned previously).
>Any suggestions or ideas?
Sorry, WFM. Maybe you are just confused in your expectations about what
you think you should see?
Jake
>tia,
>Christian
>
>----------------------------------------------
>Christian Cryder
>Internet Architect, ATMReports.com
>Project Chair, BarracudaMVC - http://barracudamvc.org
>----------------------------------------------
>"Coffee? I could quit anytime, just not today"
>
>_______________________________________________
>Barracuda mailing list
>[email protected]
>http://barracudamvc.org/lists/listinfo/barracuda