001    /*
002    // $Id: //open/mondrian/src/main/mondrian/recorder/LoggerRecorder.java#5 $
003    // This software is subject to the terms of the Common Public License
004    // Agreement, available at the following URL:
005    // http://www.opensource.org/licenses/cpl.html.
006    // Copyright (C) 2005-2006 Julian Hyde and others.
007    // All Rights Reserved.
008    // You must accept the terms of that agreement to use this software.
009    */
010    package mondrian.recorder;
011    
012    import org.apache.log4j.Logger;
013    
014    /**
015     * Implementation of {@link MessageRecorder} that writes to a
016     * {@link Logger log4j logger}.
017     *
018     * @author Richard M. Emberson
019     * @version $Id: //open/mondrian/src/main/mondrian/recorder/LoggerRecorder.java#5 $
020     */
021    public class LoggerRecorder extends AbstractRecorder {
022        private final Logger logger;
023    
024        public LoggerRecorder(final Logger logger) {
025            this.logger = logger;
026        }
027    
028        protected void recordMessage(
029                final String msg,
030                final Object info,
031                final MsgType msgType) {
032            String context = getContext();
033            logMessage(context, msg, msgType, logger);
034        }
035    }
036    
037    // End LoggerRecorder.java