001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.kernel.log;
016    
017    import java.io.InputStream;
018    
019    import java.util.logging.LogManager;
020    import java.util.logging.Logger;
021    
022    /**
023     * @author Brian Wing Shun Chan
024     */
025    public class Jdk14LogFactoryImpl implements LogFactory {
026    
027            public Jdk14LogFactoryImpl() {
028                    try {
029                            Class<?> clazz = getClass();
030    
031                            InputStream inputStream = clazz.getResourceAsStream(
032                                    "/logging.properties");
033    
034                            if (inputStream != null) {
035                                    LogManager logManager = LogManager.getLogManager();
036    
037                                    logManager.readConfiguration(inputStream);
038                            }
039                    }
040                    catch (Exception e) {
041                            e.printStackTrace();
042                    }
043            }
044    
045            @Override
046            public Log getLog(Class<?> c) {
047                    return getLog(c.getName());
048            }
049    
050            @Override
051            public Log getLog(String name) {
052                    return new Jdk14LogImpl(Logger.getLogger(name));
053            }
054    
055            @Override
056            public void setLevel(String name, String priority, boolean custom) {
057            }
058    
059    }