Re: NullPointerException in ERXLogger.getERXLogger
Re: NullPointerException in ERXLogger.getERXLogger
- Subject: Re: NullPointerException in ERXLogger.getERXLogger
- From: Lachlan Deck <email@hidden>
- Date: Thu, 28 Feb 2008 08:34:09 +1100
On 27/02/2008, at 11:35 PM, Daniele Corti wrote:
2008/2/27, Yung-Luen Lan <email@hidden>:
Hi all,
I'm a newbie of both WebObjects and server programming who is
responsible
to maintain a WO project left by other guy several years ago. I've
added
some features and tested in Eclipse. However, during these year, I
always
encountered a problem when I want to update the
ERExtensions.framework in
/Library/Frameworks.
When I replace the original ERExtensions.framework (whose version is
believed ≤ Project WONDER 3) with new one, I got the exception:
Do you also replace ERJar.framework?
Exception in thread "main" java.lang.ExceptionInInitializerError
Caused by: java.lang.NullPointerException
at org.apache.log4j.Hierarchy.getLogger(Hierarchy.java:271)
at org.apache.log4j.LogManager.getLogger(LogManager.java:220)
at org.apache.log4j.Logger.getLogger(Logger.java:156)
at er.extensions.ERXLogger.getLogger(ERXLogger.java:111)
at er.extensions.ERXLogger.getERXLogger(ERXLogger.java:91)
at er.extensions.ERXLogger.getERXLogger(ERXLogger.java:121)
at woserver.Application.<clinit>(Application.java:25)
And that's the very first line of my project.
public class Application extends ERXApplication {
public static final ERXLogger log = ERXLogger.getERXLogger(
Application.class);
Replace all of these with:
[public/private] static final org.apache.log4j.Logger log =
org.apache.log4j.Logger.getLogger( TheClass.class.getName() );
I've my Properties file configured like this:
Here's what I've got. Modify as necessary...
In Properties file:
er.extensions.ERXProperties.OptionalConfigurationFiles=(Properties/
log4j.properties,...)
And in Properties/log4j.properties:
# log4j appender and formatting
log4j.rootLogger=INFO, A1, myMail
log4j.loggerFactory=er.extensions.ERXLogger$Factory
# A1 is a ConsoleAppender
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=er.extensions.ERXPatternLayout
#log4j.appender.A1.layout.ConversionPattern=%-5p %d{HH:mm:ss} (%-20c:%
L) %x -%m%n
log4j.appender.A1.layout.ConversionPattern=%r %-5p %d{ISO8601} [%t] (%
C{3}, %M, %L) - %n%m%n%n
# A2 is a DailyRollingFileAppender
log4j.appender.A2=org.apache.log4j.DailyRollingFileAppender
log4j.appender.A2.file=/var/log/webobjects_apps/my.woa.log
log4j.appender.A2.datePattern='.'yyyy-MM-dd
log4j.appender.A2.append=true
log4j.appender.A2.layout=er.extensions.ERXPatternLayout
log4j.appender.A2.layout.ConversionPattern=%-5p %d{ISO8601} [%t] (%c:
%L) - %m%n
# myMail is the SMTPAppender
log4j.appender.myMail=org.apache.log4j.net.SMTPAppender
log4j.appender.myMail.Threshold=ERROR
log4j.appender.myMail.BufferSize=10
log4j.appender.myMail.From=<...snip...>
log4j.appender.myMail.To=<...snip...>
log4j.appender.myMail.SMTPHost=localhost
log4j.appender.myMail.Subject=Log4J Error Message (<...snip...>)
log4j.appender.myMail.layout=er.extensions.ERXPatternLayout
log4j.appender.myMail.layout.ConversionPattern=%r %-5p %d{ISO8601} [%
t] %n%n (%C, %M, %F:%L) - %n%n%m%n
########################################################################
########
# This is needed to see all startup logs
log4j.logger.NSLog=DEBUG
########################################################################
########
#log4j.logger.some.package.someclassToDebug=DEBUG
# etc
with regards,
--
Lachlan Deck
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden