logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "FLYNN, Peter -Syntegra UK" <Peter.FL...@syntegra.com>
Subject Writing a custom appender
Date Thu, 06 Feb 2003 14:48:40 GMT
Hi,
 
I'm trying to write my own appender.  The initial idea is to link into
various other systems and tie up all of the systemlogging into a single
system (Log4J).  
 
I wrote a class that extended AppenderSkeleton, but I'm getting some strange
errors from DomConfigurator when trying it out.
 
What I get is:
 
C:\Projects\bin>test
log4j: Threshold ="null".
log4j: Level value for root is [DEBUG].
log4j: root level set to DEBUG
log4j: Class name: [org.apache.log4j.ConsoleAppender]
log4j: Parsing layout of class: "org.apache.log4j.PatternLayout"
log4j: Setting property [conversionPattern] to [[%-5p] [%d{DATE}] [%C.%M:%L]
- %m%n].
log4j: Adding appender named [CONSOLE] to category [root].
log4j: Class name: [com.syntegra.logging.TestAppender]
log4j:ERROR Could not create an Appender. Reported error follows.
java.lang.IllegalAccessException: Class org.apache.log4j.xml.DOMConfigurator
can not access a member of class com.syntegra.logging.TestAppender with
modifiers ""
at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:57)
at java.lang.Class.newInstance0(Class.java:300)
at java.lang.Class.newInstance(Class.java:259)
at
org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java:164)
at
org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator.java
:140)
at
org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfigurator
.java:153)
at
org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement(DOMConfigu
rator.java:415)
at org.apache.log4j.xml.DOMConfigurator.parseRoot(DOMConfigurator.java:384)
at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:790)
at
org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:673)
at
org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:616)
at
org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:602)
at
org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.
java:460)
at org.apache.log4j.LogManager.<clinit>(LogManager.java:113)
at org.apache.log4j.Logger.getLogger(Logger.java:94)
at com.syntegra.logging.TestAppender.main(TestAppender.java:40)
log4j:ERROR Could not parse input source [org.xml.sax.InputSource@ef5502].
java.lang.NullPointerException
at java.util.Hashtable.put(Hashtable.java:389)
at
org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator.java
:141)
at
org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfigurator
.java:153)
at
org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement(DOMConfigu
rator.java:415)
at org.apache.log4j.xml.DOMConfigurator.parseRoot(DOMConfigurator.java:384)
at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:790)
at
org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:673)
at
org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:616)
at
org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:602)
at
org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.
java:460)
at org.apache.log4j.LogManager.<clinit>(LogManager.java:113)
at org.apache.log4j.Logger.getLogger(Logger.java:94)
at com.syntegra.logging.TestAppender.main(TestAppender.java:40)
[DEBUG] [06 Feb 2003 14:35:51,868]
[com.syntegra.logging.TestAppender.main:41] - Debug Test Message
[DEBUG] [06 Feb 2003 14:35:51,888]
[com.syntegra.logging.TestAppender.main:42] - Debug Test Message
[DEBUG] [06 Feb 2003 14:35:51,919]
[com.syntegra.logging.TestAppender.main:43] - Debug Test Message
Press any key to continue . . .
 
Someone must have seen this in the process of writing their own appender (or
extending an appender).  Do you know what causes it?  
 
The only thing I can think of is that my custom appender is seperate from
the log4j jar, and there might be a security issue (with ClassLoaders
loading across jars).  
 
I will continue to investigate, but in the mean time, if anyone knows
anything then it would be really appreciated.
 
Regards
Peter


********************************************************************

This email may contain information which is privileged or confidential. If you are not the
intended recipient of this email, please notify the sender immediately and delete it without
reading, copying, storing, forwarding or disclosing its contents to any other person
Thank you

Check us out at http://www.syntegra.com

********************************************************************


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message