Mikael,
Ooop, I was in a rust 2 days ago when I copied the xml text into the email, I
left out the line of xml.
So, here is the full xml and I also attached an xml file just so no tabs or
extra spaces of < chars get placed in it...
Let me know how this works for you. The original problem was the black space
(whitespace really) before the </renderer> tag, and also the order of your
tags. If you look at your dtd (log4j.dtd), you'll see this line:
<!ELEMENT log4j:configuration (renderer*, appender*,(category|logger)*,root?,
categoryFactory?)>
which means that the tags must be in this order, and you had renderer at the
end, where it needs to be first. Also, I had to switch your loggers and
appenders around.
Here is a good site on DTD's: http://www.w3schools.com/dtd/default.asp
This page in the site talked about sequences (order):
http://www.w3schools.com/dtd/dtd_elements.asp
Here are good log4j info sites:
http://www.vipan.com/htdocs/log4jhelp.html
http://wiki.apache.org/logging-log4j/Log4jXmlFormat
Here is that XML:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<!-- I created a renderer for the servlet request object so that it -->
<!-- is easy to log info about it. It's also reusable this way in all
servlets. -->
<renderer renderedClass="javax.servlet.http.HttpServletRequest"
renderingClass="com.firstpac.etools.log.HttpServletRequestRenderer" />
<!-- All output goes to eTools logfile ($TOMCAT_HOME/logs directory) -->
<appender name="log" class="org.apache.log4j.DailyRollingFileAppender">
<layout class="org.apache.log4j.PatternLayout"></layout>
</appender>
<!-- All output goes to DB for client statistics -->
<appender name="clientStats"
class="org.apache.log4j.jdbc.JDBCAppender"></appender>
<!-- This is our logger for the fpcServlets application. It logs all -->
<!-- info to files (error/debug...) -->
<logger name="com.firstpac.etools.log4j.log">
<level value="debug" />
<appender-ref ref="log" />
</logger>
<!-- This is our logger for the fpcServlets application. It logs all -->
<!-- statistics info for the user -->
<logger name="com.firstpac.etools.log4j.clientStats">
<level value="info" />
<appender-ref ref="clientStats" />
</logger>
</log4j:configuration>
-Jim Reilly
----- Original Message ----
From: Mikael Ståldal <[EMAIL PROTECTED]>
To: log4j-user@logging.apache.org
Sent: Thursday, February 21, 2008 7:00:36 AM
Subject: Different levels to different appenders
I
have
two
appenders,
MAIN_LOG
and
DEBUG_LOG.
I
have
the
loggers
set
up
to
match
Java
class
hierarchy
as
recommended.
I
have
two
interesting
codebases,
"com.mycompany"
and
"com.othercompany".
I
want
to
send
DEBUG
and
higher
from
"com.mycompany"
and
WARN
and
higher
from
"com.othercompany"
to
MAIN_LOG.
And
I
want
to
send
DEBUG
and
higher
from
"com.mycompany"
and
DEBUG
and
higher
from
"com.othercompany"
to
DEBUG_LOG.
Finally
I
want
to
handle
stuff
outside
"com.mycompany"
or
"com.othercompany"
(such
as
"org.thirdparty")
by
sending
ERROR
and
higher
to
MAIN_LOG
and
INFO
and
higher
to
DEBUG_LOG.
How
do
I
accomplish
that?
---------------------------------------------------------------------
To
unsubscribe,
e-mail:
[EMAIL PROTECTED]
For
additional
commands,
e-mail:
[EMAIL PROTECTED]
____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<!-- I created a renderer for the servlet request object so that it -->
<!-- is easy to log info about it. It's also reusable this way in all
servlets. -->
<renderer renderedClass="javax.servlet.http.HttpServletRequest"
renderingClass="com.firstpac.etools.log.HttpServletRequestRenderer" />
<!-- All output goes to eTools logfile ($TOMCAT_HOME/logs directory) -->
<appender name="log" class="org.apache.log4j.DailyRollingFileAppender">
<layout class="org.apache.log4j.PatternLayout"></layout>
</appender>
<!-- All output goes to DB for client statistics -->
<appender name="clientStats" class="org.apache.log4j.jdbc.JDBCAppender"></appender>
<!-- This is our logger for the fpcServlets application. It logs all -->
<!-- info to files (error/debug...) -->
<logger name="com.firstpac.etools.log4j.log">
<level value="debug" />
<appender-ref ref="log" />
</logger>
<!-- This is our logger for the fpcServlets application. It logs all -->
<!-- statistics info for the user -->
<logger name="com.firstpac.etools.log4j.clientStats">
<level value="info" />
<appender-ref ref="clientStats" />
</logger>
</log4j:configuration>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]