I did the following. it's not perfect but it does let my other logging system fully configure what gets sent over and what doesn't. I think the better approach is to implement the j.u.l.Logger interface with a custom log manager but that required more work at the time which didn't seem to be worth it at the time.
#logging.properties (not necessarily in jdk/lib) handlers=com.acme.MyHandler .level=INFO Then you can set the system property 'java.util.logging.config.file' Or implement your own j.u.l.LogManager and read in the config in it's constructor System.setProperty("java.util.logging.config.class", com.acme.MyLogManager.class.getCanonicalName()); public MyLogManager() { LogManager.getLogManager().readConfiguration("stream of your logging.properties file"); } And my handler looks like: public static class MyHandler extends j.u.l.Handler { /** noop. */ @Override public void close() { // do nothing } /** noop. */ @Override public void flush() { // do nothing } /** Send the log message to the other logger. */ @Override public void publish(LogRecord record) { String logName = record.getLoggerName(); // do what ever forwarding you need to in here based on the framework of your choice. } } -----Original Message----- From: Henrib [mailto:[EMAIL PROTECTED] Sent: Thursday, April 24, 2008 4:22 AM To: solr-user@lucene.apache.org Subject: RE: logging through log4j Will, I'd be definitely interested in your code but mostly in the config & deployment options if you can share. You did not happen to deploy on Websphere 6 by any chance ? I can't find a way to configure jul to only log into our application logs (even less so in our log4j logs); I'm not even sure it is feasible since IBMs documentation state that only "anonymous" loggers can escape the common sink. And since commons logging is in our bundled war for some other library, things get a tad confusing on where/what the actual configuration should be. I realize this is not the first thread on the logging topic but we've not been able (yet) to gather some experience or collect documented way of doing this for each container (Jetty/Tomcat5/Tomcat6/WebLogic/webSphere...). This is why I tend to prefer the container agnostic way of configuring logging (and else), the application/war configured way. This lead me to https://issues.apache.org/jira/browse/SOLR-549 SOLR-549 which is cross-container but (alas) requires the code to change and introduces (yet another) logging configuration convention. Henri Will Johnson-2 wrote: > > Henri, > > There are some bridges out there but none had a version number > 0.1. I > found the simplest way was to configure JUL using a custom config file and > then tell it to use my custom handler to forward all messages to log4j. > There are obvious performance implications but it is doable and fairly > simple since it didn't require any solr code changes. > > - will > -- View this message in context: http://www.nabble.com/logging-through-log4j-tp16825424p16847405.html Sent from the Solr - User mailing list archive at Nabble.com.