Use "search" to see other discussion on log4j config.
JBoss uses log4j. This means you have to play fair if you
want to reconfigure log4j.
If you break JBoss because of your changes it is your
There are two problems with log4j at the moment.
1) It uses Class.forName() to load custom classes.
This is "wrong". Log4j was written to support java 1,
since java2 the correct method is
2) Everybody shares the same logging universe. Your app
and JBoss have to use the same configuration.
Both of these problems will be fixed when log4j 1.2
is released. Currently, it is an alpha release.
With log4j 1.2, JBoss will be able to provide a
separate logging universe for each application.
This will allow you to reconfigure at much as you like,
without worrying about breaking JBoss.
Incidently, in log4j 1.2 Category is deprecated and
has changed in an incompatible way.
You will have problems with any code that sub-classes
My problem seems to be that defining a
private static final ITrace in my entity bean causes jboss to give a EXCEPTION_ACCESS_VIOLATION (see attached file). The
// causes jboss to crash
private static final ITrace trace = TraceFactory.getInstance(MemberImpl.class);
// works fine
private static final Category trace = Category.getInstance(MemberImpl.class);
My TraceFactory is a wrapper for the Category similar to the Logger that is proposed with log4j1.2.
Any ideas on why I get the exception and what is causing it.
That's a bizarre one.
An access violation occurs when you try to
introspect something that you should not be looking at,
e.g. a private field.
It might be a problem in the proxy compiler?
Sorry, I don't know much about it.
But, it is more likely a classloader problem.
Where are the classes TraceFactory and ITrace?
The TraceFactory and ITrace are in my jar file which also contains the beans that are deployed.
I guess that is the problem.
The classloader for log4j cannot
see your classes (they are in a child classloader).
Try splitting out the log4j customization classes into a
separate jar and putting them lib/ext
Depending upon your version of 3.0 you will have to
modify the list of jars at the top of jboss-service.xml
In 2.4.x you would have to modify the
archives attribute of log4jservice in jboss.conf