Log4j + JavaLoader and -Dlog4j.ignoreTCL=true

1,048 views
Skip to first unread message

Leigh

unread,
Sep 13, 2009, 2:59:54 AM9/13/09
to javaloader-dev
1). Does anyone have experience using JavaLoader + log4j (newer
version) and -Dlog4j.ignoreTCL=true flag? The jvm setting seems to
resolve some issues I was having with the three players. But does it
have any negative effects on CF's internal logging?

2) Is there any other way to force JavaLoader + log4j (different jar
version) + CF to get along?


-Leigh

Mark Mandel

unread,
Sep 13, 2009, 8:29:04 AM9/13/09
to javaloa...@googlegroups.com
I'm just about to go to bed, but you could also do:

var System = createObject("Java", "java.lang.System");
System.setProperty("log4j.ignoreTCL", true);

Should work as well.

Mark
--
E: mark....@gmail.com
T: http://www.twitter.com/neurotic
W: www.compoundtheory.com

Leigh

unread,
Sep 13, 2009, 4:16:31 PM9/13/09
to javaloader-dev
> var System = createObject("Java",
> "java.lang.System");
> System.setProperty("log4j.ignoreTCL", true);

Yep. Do you know if there are any negative effects on the rest of CF?
My thought was "no", but.. I am still learning the ropes of
classloaders. From what I have read, the jvm setting only changes
which classloader is used by log4j, either:

Thread.currentThread().getContextClassLoader() -OR-
Loader.class.getClassLoader()

My assumption is the two will always be the same when called by CF
internally (ie Both will return
coldfusion.bootstrap.BootstrapClassLoader). In which case, the setting
would make no difference to CF. Does that sound about right?

-Leigh

Mark Mandel

unread,
Sep 13, 2009, 5:54:13 PM9/13/09
to javaloa...@googlegroups.com
On Mon, Sep 14, 2009 at 6:16 AM, Leigh <cfsea...@gmail.com> wrote:

> var System = createObject("Java",
> "java.lang.System");
> System.setProperty("log4j.ignoreTCL", true);

Yep. Do you know if there are any negative effects on the rest of CF?

I don't believe so, but YMMV
 
My thought was "no", but.. I am still learning the ropes of
classloaders. From what I have read, the jvm setting only changes
which classloader is used by log4j, either:

     Thread.currentThread().getContextClassLoader() -OR-
     Loader.class.getClassLoader()

My assumption is the two will always be the same when called by CF
internally (ie Both will return
coldfusion.bootstrap.BootstrapClassLoader). In which case, the setting
would make no difference to CF. Does that sound about right?

Well, it is a system wide setting, which could influence other log4j instances.  That being said, if you did it inline with your code, like above, the CF's log4j would already be initialised, so it should be okay.

I have a vague feeling that CF uses an older version of log4j anyway that doesn't support ignoreTCL.. I'd have to double check though.
 

-Leigh

Mark

Leigh

unread,
Sep 13, 2009, 9:03:47 PM9/13/09
to javaloader-dev
> Well, it is a system wide setting, which could influence other log4j
> instances.  

Yes, good point. Now that I think about it, another option is to just
modify the source and create a new jar. That would avoid the system
setting issue altogether. Though I will probably go with the system
setting, it is good to have options.

> I have a vague feeling that CF uses an older version of log4j anyway that
> doesn't support ignoreTCL.. I'd have to double check though.

Good memory. I checked and it was MX7 that did not support that
setting. The log4j site says the ignoreTCL setting was added in
1.2.6. It is supported in CF8 because it uses a later version:
log4j-1.2.13.

Thanks for the clarifications.
-Leigh
Reply all
Reply to author
Forward
0 new messages