ah, I forget about the other bit of code you need. Place this
somewhere before you initialize log4j:
private final Object repositorySelectorGuard = new Object();
final LoggerRepository repositoryExImpl = new
LoggerRepositoryExImpl(LogManager
.getLoggerRepository());
...
LogManager.setRepositorySelector(new RepositorySelector() {
public LoggerRepository getLoggerRepository() {
return repositoryExImpl;
}
}, repositorySelectorGuard);
This will configure a different LoggerRepository implementation that
understands how to configure plugins, so you need to have this code
execute before you configure log4j. I believe Curt is working on a
way to bypass this requirement in a future log4j release.
cheers,
Paul
On 25/10/2007, at 3:52 AM, David R Robison wrote:
I've set things up as specified on the site using the log4j.xml
configuration:
<plugin name="julreceiver" class="org.apache.log4j.jul.JULReceiver" />
was placed after the appender definitions.
However, I get a warning "Unrecognized Element plugin" when
processing the configuration.
Any thoughts on what may be causing this since the format seems to
match up with the dtd?
Thanks,
David Robison
Paul Smith wrote:
On 24/10/2007, at 1:53 AM, Curt Arnold wrote:
On Oct 23, 2007, at 8:22 AM, David R Robison wrote:
We have an application that uses log4j as its logger. However,
it uses a third-party library that uses java.util.logging. Is it
possible to get the java.util.logging logger to log through log4j?
Thanks, David Robison
Please look through the log4j-dev archives for "bridge" in the
last year. There are efforts in the development sandbox to
provide bridges between log4j and java.util.logging. They
currently experimental, but I believe they are functional. I
personally wasn't involved in their development, so I can't speak
for their current condition, but maybe that will get you started
until someone more familiar with the efforts speaks us.
Curt is referring to the jul-to-log4j-bridge, which is currently
in a sandbox state, but _should_ have all the workings you need.
It's not officially released, but I'd really love some feedback
and real-world testing information.
Note: You need to use log4j 1.2.15, it is not compatible with
earlier versions as it needs to use newer api calls in log4j.
I've placed a maven-generated site here:
http://people.apache.org/~psmith/logging.apache.org/sandbox/jul-
log4j-bridge/
The latest snapshot is here:
http://people.apache.org/~psmith/logging.apache.org/repo/org/
apache/logging/apache-jul-log4j-bridge/1.0.0-SNAPSHOT/apache-jul-
log4j-bridge-1.0.0-20071007.235256-4.jar
The idea is you can configure log4j to 'assimilate' the
java.util.logging system into log4j, all corresponding loggers in
the jdk1.4 logging system are mapped into the log4j system
allowing you to configure them as normal log4j logging events.
The bridge routes the events into log4j.
Let me know how you go if you choose to try it.
cheers,
Paul
--
David R Robison
Open Roads Consulting, Inc.
708 S. Battlefield Blvd., Chesapeake, VA 23322
phone: (757) 546-3401
e-mail: [EMAIL PROTECTED]
web: http://openroadsconsulting.com
blog: http://therobe.blogspot.com
book: http://www.xulonpress.com/book_detail.php?id=2579
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Paul Smith
Core Engineering Manager
Aconex
The easy way to save time and money on your project
696 Bourke Street, Melbourne,
VIC 3000, Australia
Tel: +61 3 9240 0200 Fax: +61 3 9240 0299
Email: [EMAIL PROTECTED] www.aconex.com
This email and any attachments are intended solely for the addressee.
The contents may be privileged, confidential and/or subject to
copyright or other applicable law. No confidentiality or privilege is
lost by an erroneous transmission. If you have received this e-mail
in error, please let us know by reply e-mail and delete or destroy
this mail and all copies. If you are not the intended recipient of
this message you must not disseminate, copy or take any action in
reliance on it. The sender takes no responsibility for the effect of
this message upon the recipient's computer system.