Here is the trivial converter :)

public class JDK14LoggingAdapter extends
org.apache.log4j.AppenderSkeleton {

        protected void append(org.apache.log4j.spi.LoggingEvent event) {
                // super has already validated we are not closed and any

                // thresholds have been met...
                String loggerName = event.getLoggerName();
                java.util.logging.Logger jdk14Logger =
java.util.logging.LogManager.getLogManager()
                        .getLogger( loggerName );
                jdk14Logger.log( convertLevel( event.getLevel() ),
event.getRenderedMessage() );
        }

        public final boolean requiresLayout() {
                return false;
        }

        public final void setLayout(org.apache.log4j.Layout layout) {
                // layouts dont make any sense here...
        }

        public void close() {
                closed = true;
        }

        private java.util.logging.Level
convertLevel(org.apache.log4j.Level level) {
                switch ( level.toInt() ) {
                        case org.apache.log4j.Level.FATAL_INT:
                        case org.apache.log4j.Level.ERROR_INT:
                                return java.util.logging.Level.SEVERE;
                        case org.apache.log4j.Level.WARN_INT:
                                return java.util.logging.Level.WARNING;
                        case org.apache.log4j.Level.INFO_INT:
                                return java.util.logging.Level.INFO;
                        default:
                                return java.util.logging.Level.FINE;
                }
        }
}

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Christian Bauer
Sent: Wednesday, July 27, 2005 6:57 AM
To: Hibernate devel
Subject: Re: [Hibernate] commons logging

> I was recently informed of this thread about memory leaks occurring on
> undeploy with hibernate and saw a fair bit of criticism on
> commons-logging.
>

Btw, it would be great if someone could look into replacing commons  
logging with Log4j and providing a JDK 1.4 appender for Log4j.



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to