On Jan 16, 2007, at 8:13 PM, Lisa wrote:
....
Log4J startup gives the following error message:
log4j:WARN Attribute value "com.presence" of type ID must be
unique within
the document.
So how do you have two loggers that limit to the same package but
different
levels (debug,info)?
I agree with the other comments, but I thought it might be helpful to
explain the causes for the warnings/exceptions that you are running
into.
In this case, you have conflicting configurations for the same
logger. Loggers are identified by their names. There can only be
one logger named "org.apache.myfaces" in a logging hierarchy (and
there is usually only one of those per app). Calling Logger.getLogger
("org.apache.myfaces") will always return the same logger. Logger
names are not inherently tied to class names, but it is a very common
pattern for developers to use logger names that mimic class names.
However, you are free to design any logger naming convention that
fits your needs. The only magic thing about names is that a period
(".") is used to separate fragments of the name.
<!-- myfaces-impl -->
<category
name="org.apache.log4j.xml"
additivity="false"
class="org.apache.myfaces">
<priority value="info"/>
<appender-ref ref="JSF.INFO.LOG"/>
</category>
The idea is to have all INFO messages from org.apache.myfaces &
javax.faces go
to a jsf.info.log file.
---
Here is the exception that I get what I get when I launch my
servlet/jsp/jsf
container (running under tomcat)
log4j: Desired logger sub-class: [javax.faces]
log4j:ERROR Could not retrieve category [org.apache.log4j.xml].
Reported error
follows.
java.lang.ClassNotFoundException: javax.faces
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
The exception occurs since you specified that you wanted to use the
classes "javax.faces" and "org.apache.myfaces" as implementations of
the org.apache.log4j.Category contract. As previously noted, the
term "logger" has replaced "category" long time ago (but "category"
is still there for compatibility). Since you did not implement
classes named "javax.faces" or "org.apache.myfaces" that extended
"org.apache.log4j.Category", you were bound to get an exception.
You appear like you may be hoping that log4j can magically add
logging code to an implementation classes in "org.apache.myfaces" or
"javax.faces" packages. Log4j and other common logging frameworks
require explicitly coding logging requests within a body of code and
the authors of the code choose their own naming convention. The type
of behavior that you may be looking for would require an aspect
oriented language like AspectJ.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]