On Nov 27, 2007, at 5:55 PM, Wilfong, Paul wrote:
A couple of things about log4j and JNI...
First, I didn't realize that one of the log4j appenders,
NTEventLogAppender, uses JNI! However, it does Java calling C++,
and I
was interested in the other way around.
Second, I got an email from another source that I thought would be if
interest regarding the use of JNI - see below. I asked if it would
be Ok
to post to the log4 email list.
It looks like it might not be a good idea to try using JNI for
logging...
The performance in the below threshold case would be horrendous if you
naively JNI'd log4j to determine isDebugEnabled() etc.
There is also the non-trivial aspect of taking the C++ logging
requests which are likely to be in some arbitrary encoding and
converting them to jstring's for the JNI call. Quite a bit of the
complexity of log4cxx involves trying to get the logging messages into
an fixed known encoding (UTF-8 or UTF-16) before handing them off to
the appenders. If you really really wanted to hybridize log4cxx and
log4j, I think the best approach would be to write a JNIAppender for
log4cxx that could dispatch logging events off to some arbitrary log4j
appender. log4cxx would be responsible to discarding messages below
the threshold and converting the strings to an fixed encoding and JNI
finish the job. However, writing such a beast would be more
complicated that porting the few appenders that you likely have.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]